Exclude Child Categories Using wp_list_categories

Instead of excluding child categories, try to get only categories that have no parents (0) $cats = wp_list_categories( array( ‘parent’ => 0 ) ); That should work with no issues. EDIT: get_the_category_list() does not support advanced arguments. Your best bet is wp_get_post_categories($post_id, array(‘parent=>0’)). That will return an array of objects, you have to do the … Read more

How Can You Exclude Categories From Your RSS Feeds?

It’s been broken since 3.1, see: http://core.trac.wordpress.org/ticket/16622 and also http://wordpress.org/support/topic/wp-31-breaks-rss-customization-via-exclude_category NOTE: Otto’s suggested fix in that thread doesn’t work for me. Ticket suggests patch will go in for 3.1.1 and i can confirm that currently filters on pre_get_posts or parse_query fail for feeds(unfortunately).

Add a specific category at a specific place to the menu that uses wp_list_pages

wp_list_pages has limited functionality, and would be difficult to inject Categories into the mix without rewriting the function itself. Using the built in Menu functionality is likely the best way to go, because you can at least set individual item classes, allowing you to create Menu headers for your top level categories (having the header … Read more

WordPress Multisite – global categories

function __add_global_categories( $term_id ) { if ( get_current_blog_id() !== BLOG_ID_CURRENT_SITE || ( !$term = get_term( $term_id, ‘category’ ) ) ) return $term_id; // bail if ( !$term->parent || ( !$parent = get_term( $term->parent, ‘category’ ) ) ) $parent = null; global $wpdb; $blogs = $wpdb->get_col( “SELECT blog_id FROM {$wpdb->blogs} WHERE site_id = ‘{$wpdb->siteid}'” ); foreach … Read more

“Reversable” and “Re-useable” Subcategories (or other taxonomic structure)

The only possible way I can think to achieve this would be through getting neck deep in rewrite rules. You would have to flip your actual category structure around so that ‘exotic’ is the parent category, with two subcategories, ‘design’ and ‘travel’. Obviously you would put any posts you wanted in /design/exotic, into /exotic/design, same … Read more

How to list only child categories?

The following code is to display the subcategory instead of parent . I am not sure this is the one as you are trying too. <ul> <?php $catsy = get_the_category(); $myCat = $catsy->cat_ID; wp_list_categories(‘orderby=id&child_of=”.$myCat); ?> </ul>

How can I get an tag to wrap each ancestor that gets outputted in this condition?

To wrap your titles in h2 just change echo $ban_titles; to echo ‘<h2>’. $ban_titles . ‘</h2>’;. If you want to limit number of titles displayed to 2 change for($i=0; $i<count($pages); $i++) to for($i=0; $i<2; $i++). Hope it helps, PHP is not so scary after all 🙂 [edit] How about that? //This is the loop that … Read more