• Resolved suzzil60

    (@suzzil60)


    I am having one problem. I want to display categories and tags in the search result page. For example,I have created page called ‘CHANNELS’ and listed all the post like ‘Animals, ‘Entertainment’ inside it. Then I created category called ‘channels’ and assigned all posts inside it. (Same post that I included in CHANNELS)

    NOW what I want is When someone search for ‘channels’ in a search bar it displays a result as a page called CHANNELS, not a category called channels and all the posts inside it. I want it to display result including category called channels and all the post inside to that category.

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The search results could use a few templates, theme dependent. search.php being the most specific. Search results would not normally go to a particular page. A page would not normally display search results unless a custom query were added to its template. Placing custom queries on page templates is not optimal.

    You can modify how searches work through the “pre_get_posts” action, for example if the search term is “channels”, unset the “s” query var that searches post content and titles and set the “category_name” query var to “channels”. This will normally cause WP to use category or archive template to display results. You could add a template named “category-channels.php” that would be solely used for that one category query. The template could be set up to look just like the “CHANNELS” page you currently have.

    The end result can look the same, but this scheme better follows how WP is intended to work.

    Thread Starter suzzil60

    (@suzzil60)

    Thank you brother for your help

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to include taxonomies in search result page’ is closed to new replies.