0

I'm trying to get the archive page of a category show up in the search results. I've developed the following setup.

A category is a store, the archive page is the store's main page. Every store has posts which are there current commercials.

The URL of an archive page is example.org/store-name

I now want these URL's to show up when someone searches for the store name. At the moment it only shows the stores current commercials.

I've looked at multiple plugins (incl. search everything) but I can't get it do to this specific thing.

Hopefully someone can help me with this. Either a solution or a point of direction to create this functionality.

Thanks in advance!

1

The issue is that an archive isn't a post, it's not something that can be shown in the loop. On your search results page, you'll have to add some code to search categories for a similar name. You can accomplish this with the generic get_terms. Pass the searched term as the name__like argument (or maybe description__like if you want to store more store-specific stuff that could show in a search). get_query_var( 's' ) will give you the search term to pass.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.