Tweeted twitter.com/#!/StackWordPress/status/329052465683132417
2 edited title
| link

get_term_by - need Trying to use this or something alike but not exact match, i would likefind a way to use "LIKE"query post like normal search would do. within search.php page

1
source | link

get_term_by - need to use this or something alike but not exact match, i would like to use "LIKE"

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.

  1. 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.