Display Custom taxonomy, Child terms and posts in a template Under Specific Parent terms

This is the working code. You can try with yours $id = get_the_ID(false); $categories = get_the_category(); $parents = array(); $childs = array(); foreach($categories as $cat){ if($cat->parent == 0){ $parents[] = $cat; } else { $childs[] = $cat; } } $i = 1; echo “<div class=”sub-container”>”; foreach($parents as $parent){ if($i>3){ $i=1; echo “<div class=”clr”></div>”; echo “<hr … Read more

WP_Query for CPT with filter by another WP_Query

You’re correct in your approach. If you post your code will be better, but something like this: $args = array( ‘post_type’ => ‘project’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘region’, ‘field’ => ‘slug’, ‘terms’ => $region, //set your region ), ), ); $the_query = new WP_Query( $args ); // The Loop of Projects by Region … Read more

customize taxonomy Page

This depends on how your theme handles Taxonomy pages. If it e.g. has a category.php that does stuff different than taxonomy.php or archive.php this is the reason. Have a look here to see how the template hierarchy works.

WordPress tag or archive php file customization

put this code in functions.ph define(‘IMAGES’,get_stylesheet_directory_uri().’/img’); where img is the directory where the images for the flags are present <?php get_header(); $queried_object = get_queried_object(); $term = $queried_object->name; switch ($term) { case “china”: echo ‘<img src=”https://wordpress.stackexchange.com/questions/194142/<?php echo IMAGES; ?>/china.jpg”>’; break; case “russia”: echo ‘<img src=” <?php echo IMAGES; ?>/russia.jpg”>’; break; case “india”: echo ‘<img src=” <?php … Read more

Custom order of taxonomy using wp_get_object_terms and woocommerce_term_meta

I solved this by passing the array of terms into a sorting function. The array is passed by reference so nothing needs to be returned: function sort_object_terms(&$terms) { global $wpdb; // First get an array of just the term IDs $term_ids = array_map(function($term) { return (int)$term->term_id; }, $terms); // Now get the order value for … Read more