Echo class depending on Parent category

you probably need to get the parent category of each of the post’s categories first. <?php $parent_cat = array(); $post_cats = get_the_category($post->ID); foreach( $post_cats as $post_cat ) { if( $post_cat->parent ) $parent_cat[] = get_category( $post_cat->parent )->slug; } ?> <article class=”post <?php if ( in_array( ‘dream-it’, $parent_cat ) ) { echo ‘ dreamit’; } if ( … Read more

Remove the current item from a menu

You’ll probally want to use WP Conditional tags and do something like this: if(is_home()){ //show home menu } else if(is_page(‘mypage’)){ //show category menu for JUST that page } else{ //show the menu for all other pages } What you do inside each conditional statement is up to you. Here are 3 solutions: Use CSS and … Read more

how to edit wp category widget

// This alters the get get_terms() arguments and hides some categories function widget_category_excluder( $args ) { // Replace the numbers with category IDs you need hidden $args[‘exclude’] = $args[‘exclude’].’,1,2,3,’; // Keep it safe! // Or use exclude_tree to exclude children categories also // $args[‘exclude’] = $args[‘exclude’].’,1,2,3,’; // Keep it safe! // (,1,2,3, is enclosed in … Read more

How to have a category not show up in query post with page panigation?

When using cat in the query you need to specify the category id not name. Try this. <?php $gallery = get_cat_id(‘gallery’); $shirts = get_cat_id(‘shirts’); $hoodies = get_cat_id(‘hoodies’); $excluded_cats=”-“.$gallery.’,-‘.$shirts.’,-‘.$hoodies; $limit = 5; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; query_posts( ‘cat=”.$excluded_cats.”&showposts=” . $limit . “&paged=’ . $paged ); ?>