This thread might be helpful. I haven’t tried out the plugin myself, but the demo looks fantastic.
Thanks…that’s not exactly what I am looking for but it’s cool.
Maybe there’s the potential to modify the plugin. It might also be an idea to email the plugin author as well 🙂
I found this which is close…not sure how to implement this.
wordpress.org/support/topic/145593?replies=3
Try leaving out the minus sign when including the categories, and see if that limits the search to those categories, rather than exclude them.
So:
<?php
if( is_search() ) :
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("s=$s&paged=$paged&cat=1,2,3");
endif;
?>
Thank you for the help. I think this will do the trick!
You’re welcome! :)Thanks for the feedback! It’s always good to know when a suggestion works
I don’t know where this code is placed – could you elaborate on the placement of this code and anything else I’d need to know to create a search result on a specific category?
Thanks so much.
Hi,
I was exactly looking for a piece of code to limite the search to certain categories. Your code works well !!
<?php if( is_search() ) :
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("s=$s&paged=$paged&cat=1,2,3");
endif; ?>
But, I want the category to be dynamic :
From the web page archive.php, I want to store the current category (something like $my_category = “current categorie”) and call this variable in the search result web page search.php (query_posts(“S= …” cat=”.$my_category). As I am a dummy in PHP langage, I don’t know what I need to write …. could you help me?
Thanks in advance