conditional error based on category?
-
Apologies first for what is likely a dumb question. I’m new to WordPress and PHP so I’m already over my head. It concerns this part of the code:
if ( count( $this->catlist->lcp_categories_posts) == 0 ) { $lcp_display_output .= '<li>No results</li>'; }I just need a different error when there is no results but when in a particular category (‘news’). I modifyied the error code but I’m getting identical results.
if ( count( $this->catlist->lcp_categories_posts) == 0 ) { if ( in_category( 'news' )) { $lcp_display_output .= '<li>No news results</li>'; } else { $lcp_display_output .= '<li>No results</li>'; } }I’m trying to filter the error but it doesn’t seem to evaluate the category at all. I always defaults to the last ‘else’ result.
I could really use some help…sigh.
The topic ‘conditional error based on category?’ is closed to new replies.