Display Categories Assigned to a WooCommerce Product

I have solved the issue with creating a list with http://codex.wordpress.org/Template_Tags/wp_list_categories changing style to list, then style it with CSS to my needs 🙂 <?php $taxonomy = ‘product_cat’; // get the term IDs assigned to post. $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( ‘fields’ => ‘ids’ ) ); if ( !empty( $post_terms ) && !is_wp_error( $post_terms … Read more

Listing child terms of parent term

When you are on a taxonomy page, you can get the parent from the term being displayed by using the following code with get_queried_object. See get_terms for the objects that are returned $queried_object = get_queried_object(‘term’); $term = $queried_object->parent; To get the taxonomy, you can simply just add $tax = $queried_object->taxonomy; below the code above. This … Read more

Hierarchical display of custom taxonomy

The wpse244577_list_terms() function below uses wp_list_categories() to do the heavy lifting, then modifies the results so that the terms are in reverse order of the hierarchy. Place this code in a plugin or your theme’s functions.php file: /** * Lists term links for a taxonomy in reverse order of hierarchy * * Based on https://developer.wordpress.org/reference/functions/wp_list_categories/#comment-1169 … Read more

get_the_term_list without specific category

I believe that what you want is to exclude a term. It is odd that such is not an option with that function but you can use a filter on get_the_terms: function exclude_my_term($terms, $post, $taxonomy) { remove_filter(‘get_the_terms’,’exclude_my_term’,10,3); unset($terms[123]); // where 123 is the ID of the term to exclude return $terms; } add_filter(‘get_the_terms’,’exclude_my_term’,10,3); You probably … Read more

Custom Taxonomy terms with latest post ordered by date pagination issue

to change the number of posts per page you can do it in the wp dashboard like in this picture This function on functions.php works for me function tcPostsPerPage( $query ) { if (is_home()){$query->set(‘posts_per_page’, 6);} if (is_archive()){$query->set(‘posts_per_page’, 6);} } add_action( ‘pre_get_posts’, ‘tcPostsPerPage’ ); the two 6 is limiting to 6 per page, if this doest … Read more