• Resolved jonwatson87

    (@jonwatson87)


    I’m probably being dense, but I can’t seem to figure out what the issue here is.

    The site I’m developing uses a custom loop, with a query that excludes any posts ticked as archived.

    The reason I want to edit the tag.php template is to output custom meta to the front end, and tweak the appearance of all posts on the archive pages.

    It works perfectly for the majority of the site, but on tag.php it causes to tag cloud to break, making any and every tag clicked bring up the full post list.

    When I remove the query the tag cloud works fine, but archived posts are still displayed and aren’t laid out the way they need to be.

    The query code I’m using is:

    // The Queries
         $args = array(
    	'post_type' => array('post', 'report', 'analysis', 'guest-blog'),
    	'order'     => 'DESC',
    	'meta_query'     => array(
    		array(
    		'key'     => 'epi_pubarchive',
    		'value'   => 1,
    		'compare' => '!=',
    		)
    	)
         );
    
         $the_query = new WP_Query( $args );

    The meta key, epi_pubarchive, is a checkbox created using Meta Box, essentially checking if the box is ticked or not.

    I’ve tried removing the meta_query and trying it with the basic post_type and order args, but that won’t work either.

    Anyone know what the issue with tags and queries is?

    Is there a better way to achieve the desired result?

  • The topic ‘WP_Query on tag.php’ is closed to new replies.