<?php
// Resetto la query se necessario
//wp_reset_postdata();
/**
* Preparo gli argomenti
*
* Possibili parametri:
* 'orderby' => 'title',
* 'order' => 'ASC',
* 'posts_per_page' => 3,
* 'category_name' => 'featured',
* 'cat' => -1 //esclude una categoria o pi? categorie dalla query
*/
$args = array(
'post_type' => 'portfolio',
'order' => 'DIS',
'taxonomies' => array('post_tag'),
);
// Eseguo la query
$the_query = new WP_Query($args);
// Conto gli elementi
$count = $the_query->post_count;
?>
I insert the code I used to generate the single tag page. The single tag link “year_work/2014/” works perfectly but I would like there to be a “year_work” page I am asking you what query I should use to retrieve the tags of a custom post so that there are for each tag 5 posts with this pattern:
<h1>2014</h1>
post
<h1>2015</h1>
post
Thanks