I have a costume search in a site i am making.
When a user search a certain term, i want to display category list with a count of how many posts are found with in that category.
I thought of a way but i have problems doing it.
- in search.php in the loop in
have_posts()
, i will add a line that check each post's category and create an array with those categories ... and just +1 each time a certain category repeat itself...... problem with that since pagination is in place, it will only find the categories for the current page while the remaining pages stay unaccounted for.
The fix for that is having another wp_query that just use the s
term. without the pagination.
Problem with that is i dont know how to query wp for a certain term like a normal search would do. i though of using query_posts
somehow but still unclear on how.
Thanks in advanced.