Home > custom field > Need small coding with Custom Fields Search

Need small coding with Custom Fields Search

June 25Hits:2

WP Custom Fields Search is a great plugin but I've a problem regarding the plugin returning results using the homepage.

When I click the submit button, results are shown on the homepage instead of the search.php page!

Searching on the web, I've read that the plugin should output search results on the search page template or, if search.php is missing, on the homepage.

My theme has search.php but the plugin is not using it: I need to force the plugin to output search results in the search results page.

Looked at the plugin's code and quite sure that some code should be changed in the “extra_search_fields.php” file but I'm not sure where and how to force the results to output on the search template instead of the homepage. Guess that at about line 230 is where to hack the code:

function renderWidget($params=array(),$p2 = array()){     $title = $this->getTitle($params);     $inputs = $this->getInputs($params);     $hidden = "<input type='hidden' name='search-class' value='".$this->getPostIdentifier()."'/><input type='hidden' name='widget_number' value='".$p2['number']."'/>";     $formCssClass = 'custom_search widget custom_search_'.$this->nameAsId();     $formAction = get_option('home');     if(function_exists('locate_template'))         $formTemplate = locate_template(array('wp-custom-fields-search-form.php'));     if(!$formTemplate) $formTemplate = dirname(__FILE__).'/templates/wp-custom-fields-search-form.php';      foreach($inputs as $k=>$v){         if($v->isHidden()){             $hidden.=$v->getInput(false);             unset($inputs[$k]);         }     }     include($formTemplate); }  function isPosted(){     return $_GET['search-class'] == $this->getPostIdentifier(); } function getPostIdentifier(){     return get_class($this).'-'.$this->id; } function isHome($isHome){     return $isHome && !$this->isPosted(); } function rewriteHome($homeTemplate){     if($this->isPosted()) return get_query_template('search');     return $homeTemplate; } 

Can someone please help me?


Instead of $formAction = get_option('home'); use $formAction = get_template_part( 'search' );

Related Articles

  • Need small coding with Custom Fields SearchJune 25

    WP Custom Fields Search is a great plugin but I've a problem regarding the plugin returning results using the homepage. When I click the submit button, results are shown on the homepage instead of the search.php page! Searching on the web, I've read

  • Special characters WP Custom Fields SearchSeptember 9

    I am using WP Custom Fields Search for my custom content Search. I have the problem, that my special characters are not displayed as utf-8 character. Database is correct utf-8 ... Thanks

  • How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?

    How to filter post listing (in WP dashboard posts listing) using a custom field (search functionality)?May 7

    Despite the fact I googled a lot, I've not found the answer to a very simple question : I have some posts with a custom field (i.e. supplier_name). I would like to be able to search and filter my posts according to this custom field. In other words,

  • Custom field Search with RelavanssiMarch 24

    The site I'm working on is a talent website that has actors names, headshots, and resume all created with post_title, featured images, and custom fields. I am using Relavanssi to make my search results work a little better. However, I am running into

  • Commerce Search API with Custom field searchJuly 8

    I have a Custom search form with multiple fields on my front page. After clicking on submit button, user would be routed to search result page. (Ideally, a Commerce search view). On search result page, all facets blocks are enabled. Products are mapp

  • how to disable list item's attachment using coding in custom field of sharepoint foundation 2010January 26

    how to disable list item's attachment using coding in sharepoint 2010 Please help. I will provide further screen shots if needed. --------------Solutions------------- You can set this via the SPList object using the EnableAttachments property. Here's

  • admin : search custom fieldsJune 28

    One year ago @t31os answered a post with a code I can't access: http://wordpress.org/support/topic/search-custom-field-data His answer... I was feeling adventurous, so i wrote a simple plugin to do it.. http://wordpress.pastebin.ca/1736605 The post s

  • Search Custom Post Type Pages and Custom Fields in 2 Dropdowns?December 5

    On my custom post type pages I have custom fields that the user can edit. What I want is to have a search form with 2 select dropdowns: one dropdown that is populated with all the top-level custom post type pages, and the other dropdown to narrow the

  • Custom Fields Not in Search ResultsJanuary 25

    I noticed that the content of my custom fields is not in my search results. Is there a good remedy for this? I could just hardcode my content into page templates but I would like the content to be searchable. Thanks. --------------Solutions----------

  • Search in Archive Pages by subcategory, tag, custom field and yearJuly 19

    I've been struggling to find the best solution for a better (custom) search. I'm using WordPress for a large Media Catalog, so my intention is to provide better search options. So far I've been able to put various search forms in the archive.php that

  • Limit search field to just search a custom post type with custom fieldsFebruary 15

    I'm sure this is possible, I just don't think I am going the right way about it. Basically, I have two custom post types (Investigators & Centres), both of which have search forms on their respective archive pages (below) to filter the archive based

  • Search prices using drop-down range with WP Search Custom Fields pluginJune 30

    I've built a search form using WP Custom Fields Search. The form searches a number of custom fields, all of which work perfectly.. except for one. I've set up a field in the search form with the following settings: Name = Price Data Type = Custom Fie

  • Can a Custom Field Type reference other Fields?October 7

    One of the common issues we have with SharePoint is that we want to display a whole lot of information about a user in a list, for example Job Title, Phone Number or Manager. We want to have this information in a read-only field of the list, so that

  • Search through custom post type and custom fields takes 5 minutesMarch 10

    I got strange problem and I'm stuck. I have custom post type with around 15 custom fields. I moved data from old db (not WP) by using wp_insert_post ,update_post_meta and wp_set_object_terms. All went good. All vcards works fine. I got 3500 vcards an

  • Including custom fields in search?May 31

    I use custom fields for lots of my content on both Posts and Pages, so that half of the text will be in the main post body and the other half in a custom field. Unfortunately, when doing this only the text in the post body is searchable. I want to ha

  • How to modify the Drupal Solr Search fields / apply custom fields / modify resultsJuly 11

    Am attempting to understand the report in admin/reports/apachesolr (Drupal 6). There are a large number of fields, and I am trying to understand 1) Are these the fields within the Solr index that are being populated, or are these within Drupal? 2) As

  • how to search in custom fields & custom taxonomy for custom searchJuly 19

    I have a custom search which is a form that submits to the same page and uses wp_query to filter the results for a jobs site that I would also like the keyword search to also search in custom fields and a custom taxonomy but I am unsure how to use po

  • Search Custom Post Type Custom FieldsAugust 10

    There are tutorials that explain how to limit a search to a specific category. My question is, is there a way to configure wordpress' search to, within a custom post type, search for a custom field value. So for example, if I search for "hello",

  • Searching with Multiple (Parallel) Criteria on Custom Fields?October 14

    I'm just an basic Wordpress user. I need to make search box with multiple criteria inputs (multiple conditions) to search inside various Custom Fields. For example including following Custom Fields: Color: ____ Size: ____ Price: ___ Condition: ___ Di

  • Advanced search form with filters for custom taxonomies and custom fields

    Advanced search form with filters for custom taxonomies and custom fieldsJanuary 9

    I'd like to build an advanced search form for a specific custom post type, having filters for the custom post types custom fields, custom taxonomies, and for a separate custom post types properties (fields and taxonomies) which will be links to the f

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.608 s.