• Hi,

    I am trying to have a separate search function for the two search bars on this page.

    For the search bar on the top, I want to keep it working as it is to search for products.
    For the search bar on the right hand side, I want this to search for “posts” only, to only display blog posts in the results. I had a developer that input the codes to have this separate function, but it has stopped working, and no results are returning for this search bar.

    in contents.php, I found the following codes:
    <?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
    I’m not sure if this is relevant to defining this search bar.

    Can anyone please give me some advise on how to fix the right hand search bar to only display blog posts?

    Thank you very much.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • If it’s custom code, we don’t know what it’s doing. It’s best to ask the author.

    Thread Starter joyce2020

    (@joyce2020)

    Thanks @joyously
    We can’t get a hold of the developer, is there any way we can override what he has done to make the blog search function work?

    You could, and fix it, if you knew what was what.
    The code you quoted is only about displaying the category and tags on the search page. It’s not about the search itself, which is handled by WordPress (unless it is filtered by custom code like a plugin).

    You can isolate where the code is, using the Health Check plugin in Troubleshoot mode. This allows you to disable theme/plugins for your user only. Once you know if the code is in the theme or a plugin, you at least know what code you can replace with a different plugin to modify the search. Or you can find someone at https://jobs.wordpress.net to figure it out.

    Thread Starter joyce2020

    (@joyce2020)

    Thanks @joyously
    I checked my plugins, the only search related plugin I can see is “YITH WooCommerce Ajax Search Premium”, which controls the search bar on the top of the page which searches for products.
    I think the search bar on the blog page on the right hand side has been edited by custom coding in the theme file.
    If you can point me to the direction of where or how to find the blog page template with this search function, I would really appreciate it. Then I can do some experiments with changing the codes for the search function.
    Thank you very much for your help.

    Themes don’t have functions in template files, so the code might be anywhere else. If the theme is totally custom, you should ask the author.
    If it’s from the WP repository or bought somewhere, then you can use a comparison program to compare the files that are on your site with the original files of the theme. Or if you have a child theme, it’s probably in there.
    Or it could be code in a custom plugin (it belongs in a plugin, not a theme).
    Again, Health Check can help you isolate it.

    Thread Starter joyce2020

    (@joyce2020)

    Hi @joyously
    Thank you for your response and help, I really appreciate it.
    I’m quite sure the search plugin installed isn’t affecting the blog search for posts. I’ll look through the child theme for the custom code.
    What would you say is the best term to look for?

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘separate search function’ is closed to new replies.