How to get grandparent of a given category

You could write a simple function to do this each time you need to. Here’s an example I found on this website. function pa_category_top_parent_id( $catid ) { while( $catid ) { $cat = get_category( $catid ); // get the object for the catid $catid = $cat->category_parent; // assign parent ID (if exists) to $catid // … Read more

Category index featured image

What I did was; using the Taxonomy Images plugin to associate an image with each category, then to my theme’s header.php, below the <a> line in the above code; <?php $image_id = apply_filters( ‘taxonomy-images-queried-term-image-id’, 0 ); if ( is_category() && ! empty( $image_id )): print apply_filters( ‘taxonomy-images-queried-term-image’, ”, array( ‘image_size’ => ‘header’ ) ); else … Read more

woocommerce product category tabs [closed]

If you mean ‘tabs’ as in the way WooCommerce presents the Product Description, Attributes, and Review on the product page then take a look at the template files for WooCommerce. You can find them at ../wp-content/plugins/woocommerce/templates. There’s a good article on customizing the templates at http://wcdocs.woothemes.com/codex/template-structure/ You need to follow these guidelines to make sure … Read more

Show Available Taxonomy List with Current Category

I’m not hundred percent sure but I think the widget in scribu’s plugin, Query Multiple Taxonomies, works exactly as you described. You can find plenty of resources on the subject on his blog. This plugin lets you do faceted search using multiple custom taxonomies. It has a drill-down widget with multiple display modes. Said widget … Read more

Get only one of the current categories

get_the_category should be returning all of the categories for your post, but you are only picking one of them, the first one, when you do this– $category = $category[0]->cat_ID;. Instead of that line try: $allcats = array(); foreach ($category as $cat) { if (29 != $cat->cat_ID && 35 != $cat->cat_ID) { $allcats[] = $cat->cat_ID; } … Read more

Category location styling

The way i fixed the issue was to insert the following code into my main CSS. .post-categories, .post-categories li {display:inline; padding: 0px;} I hope this helps others in this issue in the future.

Show category images on single product page and product overview page

I had the same problem and I came up with this solution, hope it helps. <?php $terms = get_the_terms( $post->ID, ‘product_cat’ ); foreach ( $terms as $term ){ $category_name = $term->name; $category_thumbnail = get_woocommerce_term_meta($term->term_id, ‘thumbnail_id’, true); $image = wp_get_attachment_url($category_thumbnail); echo ‘<img src=”‘.$image.'”>’; } ?>