WP Query conflict on tag.php and category.php template

Just in case anyone happens to run into this same problem, my round-about solution for taxonomy template query conflict: clone the main query NULL the query define new WP_Query re-instate cloned query Tested and working in header.php <?php global $wp_query; $temp_query = clone $wp_query; global $post; $temp_post = clone $post; $wp_query = NULL; $wp_query = … Read more

Calling the first & last post by category in custom post type

It is sometimes irritating that some build-in functions don’t have appropriate filters to modify their output. get_boundary_post() is one of those build-in functions. Unfortunately it does not get posts according to post type, only taxonomy. You can still however make use of this function to get the first and last post. It does support the … Read more

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