wp_list_categories with show_count, except for specific categories
Check out this post. It shows you how you can wrap the count with any element you’d like so that you can manipulate it as you see fit.
Check out this post. It shows you how you can wrap the count with any element you’d like so that you can manipulate it as you see fit.
By default wp_list_categories() doesn’t show post count, because show_count is set to false, check arguments passed into wp_list_categories().
try: global $query_string; query_posts( $query_string . ‘&cat=-81’ ); http://codex.wordpress.org/Function_Reference/query_posts#Preserving_Existing_Query_Parameters
If you use category__in and category__not_in instead, it will only pull the posts that are in that category, not the subcategories as well. For your code, this would look something like this: $args = array( ‘category__in’ => $cat, ‘category__not_in’ => $catHidden ); Note: this will only exclude posts that are directly in the category as … Read more
get_category_by_slug() returns a category object or FALSE: $cat1 = get_category_by_slug( ‘cata’ ); print ‘<pre>’ . htmlspecialchars( print_r( $cat1, TRUE ) ) . ‘</pre>’; Result: stdClass Object ( [term_id] => 3 [name] => Cat A [slug] => cata [term_group] => 0 [term_taxonomy_id] => 3 [taxonomy] => category category__not_in and id values from variable => [parent] => … Read more
get_categories() only lists categories, so you shouldn’t be seeing any terms from the custom taxonomy. What you want to use is get_terms() which takes a taxonomy as an argument. As you can read about in this answer, get_terms() is actually used by get_categories(), it just prefills the “taxonomy” argument with “category.” If you swap in … Read more
The best approach here would be to add a meta box to the posts wich let’s you enter additional Metadata to your posts. In this case the relevant doctors name and the link. Refer to the codex page for the add_meta_box() function and, if that’s too condensed or too little info for your liking, check … Read more
The unnecessary semi-colon is probably causing the error. <?php } else { ;?> should be <?php } else { ?>. Try this: <?php if (in_category( array(6,14,15,13) )) { ?> <div id=”eatheader”> <?php } elseif (in_category( array(7,11,12,10,9) )) { ?> <div id=”goheader”> <?php } elseif (in_category( array(4,16,17,18,19) )) { ?> <div id=”playheader”> <?php } elseif (in_category( … Read more
This could be solved via CSS as well. Just set up declarations for the special cases where there is overlap between categories: .category-cars { background-color: #f00; } .category-bikes, .category-cars.category-bikes { background-color: #0f0; } This will give any posts that are in both bikes and cars the same background color as those used in the bikes … Read more
Here’s a function that get’s the category from the post and then displays an unordered list of term children links. I’m assuming you only have one category per post. If you don’t, then you’d have to iterate through $cat_id in addition to $cat_children: // get category id $cat_id = get_the_category(); // get array of all … Read more