Display all product tags associated with a specific product category

Ahh ha! Have figured out how to do this. Here’s the code for future people who are looking for the same thing: function get_category_tags($args) { global $wpdb; $tags = $wpdb->get_results(” SELECT DISTINCT terms2.term_id as tag_id, terms2.name as tag_name, terms2.slug as tag_slug, null as tag_link FROM wp_posts as p1 LEFT JOIN wp_term_relationships as r1 ON p1.ID … Read more

About title on a page

The best way to modify how a theme presents an archive is to create a child theme and then create a specific altered version of the page you want “fixed”. Template files follow a hierarchy with the most specific file available used. In your case, you could create a file called something like category-finanzasya.php (depending … Read more

Link To Child Category For A Post

You can use get_category_link() for that: $allCat = get_the_category(); if( ! empty( $allCat ) ){ $lastCat = array_reverse( $allCat ); $last_cat_link = get_category_link( $lastCat[0] ); if( ! is_wp_error( $last_cat_link ) ){ echo ‘<a href=”‘ . $last_cat_link . ‘”>’ . $lastCat[0]->name . ‘</a>’; } } https://developer.wordpress.org/reference/functions/get_category_link/

Cannon see subcategory in permalink

Good question. WordPress determines the permalink by finding the category closest to the root. If the parent category is selected (or if both the parent category and the child category are selected), then the permalink will only include the parent category. If only the child category is selected, then the permalink will include the parent … Read more

Custom Meta Box (SELECT2) Not Saving Taxonomy Terms

First of all you saved the the terms value in a post meta table and not following the wordpress conventional method. To make it connect with default category with that post you need to modify your save_post action. Check the modified code. add_action( ‘save_post’, ‘rudr_save_metaboxdata’, 10, 2 ); function rudr_save_metaboxdata( $post_id, $post ) { if … Read more

List just subcategory and products of active category page in Woocommerce

The code below works for me in archive-product.php not sure if it may also work in taxonomy-product_cat.php EDIT I’ve added some lines of code to exclude posts previously outputted, since a post can belong to several categories and that’s why you can find always the same posts if(is_a(get_queried_object(),’WP_term’)){ $subs=get_terms(‘product_cat’,array(‘parent’=>get_queried_object()->term_id)); //var_dump($subs); $to_excude=[]; foreach($subs as $sub){ $args … Read more

Echo text using is_tag

That’s not what is_tag does: Determines whether the query is for an existing tag archive page. https://developer.wordpress.org/reference/functions/is_tag/ is_tag and other functions such as is_search etc don’t tell you anything about a post, they tell you if you’re on a search archive, or a tag archive, etc So is_tag is true on example.com/tag/example but would be … Read more