Getting category ID and checking if tags exist
-
Heya guys, I need help with two quick things:
First, how could I find out if there are any tags for a post? I need to check if there are tags, and do one piece of code (HTML / CSS), and if there aren’t any, do another few lines code.
I can’t find a function like that in codex :/Second, how could I get category ID’s for a post?
I’m getting my posts with
$the_query = new WP_Query (...)
, and writing them out with
while ($the_query->have_posts()) : $the_query->the_post(); $do_not_duplicate = $post->ID;
I need to get category ID’s for every post and count how many posts from certain categories are there on the frontpage.
I would then use that to determine the offset for displaying more posts from the categories (one category at a time).To make things short – I want to display last 10 posts (with thumbnail, excerpt etc) on the front page, and below that display last 5 posts for every category with titles and small thumb only (excluding ones already displayed).
- The topic ‘Getting category ID and checking if tags exist’ is closed to new replies.