Código PHP:
2015 nov decVer original
function twentyeleven_get_archives_callback($item, $index, $currYear) { global $wp_locale; if ( $item['year'] == $currYear ) { $url = get_month_link( $item['year'], $item['month'] ); // translators: 1: month name, 2: 4-digit year echo get_archives_link($url, $text); } } function twentyeleven_get_archives() { global $wpdb; $query = "SELECT YEAR(post_date) AS <code>year</code> FROM $wpdb->posts WHERE <code>post_type</code> = 'post' AND <code>post_status</code> = 'publish' GROUP BY <code>year</code> ORDER BY <code>year</code> DESC limit 4"; $arcresults = $wpdb->get_results($query); if ($arcresults) { } } $query = "SELECT YEAR(post_date) as <code>year</code>, MONTH(post_date) as <code>month</code> FROM $wpdb->posts WHERE <code>post_type</code> = 'post' AND <code>post_status</code> = 'publish' GROUP BY <code>year</code>, <code>month</code> ORDER BY <code>year</code> DESC, <code>month</code> ASC"; $arcresults = $wpdb->get_results($query, ARRAY_A); if ( $arcresults ) { foreach ($years as $year) { //My Display //echo "\t<li>\n\t\t<a href=\"#\">$year</a>\n\t\t<ul>\n"; //array_walk($arcresults, "twentyeleven_get_archives_callback", $year); //echo "\t\t</ul>\n\t</li>\n"; //Your Display echo "\t<div class='listYearArchive'><span class='yearArchive'>$year</span>\n\t<ul class='listMonthArchive'>\n"; echo "\t</ul></div>\n"; } } }
2104 may nov dec
"nov" "dec" son link el cual me muestra en la url: http://www.xxx.com/2015/11 los post de esa fecha.
Esto usando archive.php
La pregunta es: como podria hacer esto mismo pero filtrando estos link por custom post type ??