jared123
Member
Posted 11 months ago #
In my search results page on my theme, the category of each post that is turned up by the search is displayed. this is fine. the problem is, if the search finds a match in a Page, then it shows the Page as being posted in "uncategorized" even though pages don't have categories.
i am trying to figure out a way to test if the current post is a page within the search results loop and not print the category if it is a page.
how would i go about that?
I'd guess the Conditional Tag, is_page() would work.
jared123
Member
Posted 11 months ago #
MichaelH - thanks, but I tried that already and it doesn't work. i think it's because is_page() tests for what sort of page you're on, and in a search results page, this always returns false.
Then in a post loop what about testing for 'page' == $post->post_type
jared123
Member
Posted 11 months ago #
brilliant! that did it, many thanks!
SUPER! worked also for me, live can be as easy as this:D
THANKS!