Tag Info

Hot answers tagged

2

As documented in the codex you could use the following $query = new WP_Query( array( 'category__and' => array( 2, 6 ) ) ); //post has to be in category with ID 2 AND 6


2

As I already stated, straight from the codex exclude (string) Excludes one or more categories from the list generated by wp_list_categories. This parameter takes a comma-separated list of categories by unique ID, in ascending order As you have stated, you have to use the category slug. To make this possible and dynamic, I think the best will be to ...


2

I'm a bit unsure of you are actually asking, so apologies if I understood it wrong. You can use get_category() to get the category object and then just simply echo the $count property value $cat_count = get_category( 'ID OR ROW OBJECT' ); echo $cat_count->count;


1

From what I can tell, this stems from your use of get_post_field(), which is reserved for fields found in the posts table of the database (ie: built-in to WordPress, rather than custom fields). For custom fields you should use get_post_meta().


1

Use this one- 'category__not_in' => array( 93, 94, 95 ), instead of- 'category_not_in' => 93, Note: The term is category__not_in, not category_not_in. Use 2 underscores after category. Edit: You are using- 'offset' => 1 That forces to show posts from 2nd one (skips the first post). So, it's showing one post less! If you use 'offset' => ...


1

You can try looping to match the category name you need. $categories = get_the_category(); $category_name = 'foo1'; // set this to the category name you want to show $output = ''; if($categories){ foreach($categories as $category) { if ( $category_name == $category->cat_name) { $output .='<div ...


1

I think this is more a general question than a specific one and I'll be treating it as such. Taxonomies in general are used to group posts together that shares the same characteristic. The post_tag and category taxonomies are the most widely and commonly used of the four build in taxonomies to achieve this. Also very popular are custom taxonomies which ...



Only top voted, non community-wiki answers of a minimum length are eligible