WordPress.org

Ready to get started?Download WordPress

Forums

WP Query Search Filter
[resolved] Search Terms Blank (5 posts)

  1. amycarolyn
    Member
    Posted 1 year ago #

    This plugin seems to be working well, that's exciting. I noticed the search terms are blank though. I wanted to have the results say, You searched for [metakey1 option x] in [metakey2 option y]. But right now the results just say "You search for:" and where the search terms normally appear, it's blank. Is there a way to include the search terms when using only the Custom Meta Field with Custom Post Type search?

    http://wordpress.org/extend/plugins/wp-query-search-filter/

  2. TC.K
    Member
    Plugin Author

    Posted 1 year ago #

    @amycarolyn,
    You can include the search term by customize your theme's search.php file. But themes usually have the different approach to get the search term. So it is hard to tell which specific part you need to customize.

    Commonly most themes are using

    get_search_query()
    to get the search terms. If your theme have this line then it is the place you need to customize. You can paste the following codes in your function.php.

  3. amycarolyn
    Member
    Posted 1 year ago #

    Thanks! I did try this. With one of the dropdowns empty I get:

    Search Result for Food & Beverage,,wqsfcmfall

    Do you know what I might have done wrong?

    Thanks again for the code sample.

  4. TC.K
    Member
    Plugin Author

    Posted 1 year ago #

    I hv modified the codes.
    For empty dropdown option (in your case), you can change the line
    if($v['value'] =='wqsfcmfall'){$sterm[]= 'you can put value here'; }//

    This is not the ideal solution though, maybe i will come out a better solution in the future.

    Right now I am busy with something else, hope that i can squeeze some time for this plugin. Because I am planning doing a major upgrade to this plugin, and this search term feature will be included.

  5. amycarolyn
    Member
    Posted 1 year ago #

    Thanks, this fixed the issue of wqsfcmfall appearing when the selection is blank. Thanks again.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.