Site logo

Archived topic

Search box for single category posts

4 replies · Started by STENCIL on August 18, 2022

Viewing posts 1–5 of 5

Hi there,

Loving using GP!

Wondering if I can setup a specific search box...

I have two post categories ‘blog’ and ’portfolio’ (didn’t want to get into custom post types - so they are together in one post type)

I've split them up by creating two pages, each with query loops on to display the particular categories posts - they each have different page designs.

For ‘blog’ categories page I have a sidebar with links to archives for tags (which is what I’m using to filter the blog specifically - so category is left as just the two options). But I would like a search, however it searches the complete site. Is there a way I can set the search to just search posts, and even better the 'blog' category posts only?

I found this php to create an end point but didn't work -


add_action( 'init', 'wpse31422_init' );
function wpse31422_init()
{
    add_rewrite_endpoint( 'year', EP_CATEGORIES );
}

oh thank you! Didn't think a plugin would do the job. Appreciate the help!

You're welcome

This archived topic is closed to new replies.