Using wp_tag_cloud with only current post tag with special class

I was able to achieve this by following code: $allterms = get_terms( $taxonomy ); $pterms = get_the_terms( $post->ID, $taxonomy); $tag_list = implode(‘,’, wp_list_pluck($pterms, ‘term_id’) ); $t = explode(‘,’, $tag_list); echo ‘<div class=”tag-cloud”>’; foreach ($allterms as $term) { if (in_array($term->term_id, $t)) { echo ‘<span class=”stag active”>’.$term->name.'</span>’; } else { echo ‘<span class=”stag inactive”>’.$term->name.'</span>’; } } echo … Read more

Best Method to Switch Between Terms (Custom Taxonomy)

If I am reading your code and description correctly, you can simplify that to: $taxonomy = ‘delivery_option’; $do = get_the_terms($post->ID,$taxonomy); if (!empty($do) && !is_wp_error($do)) { $do = array_shift($do); // assuming a single value as per the description. $term = str_replace(‘-delivery’,”,$do->slug); get_template_part(‘includes/sidebar-part’,$term); } else { echo ‘<p>No custom include!</p>’; } Note, I used WordPress’s get_template_part() instead … 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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)