Adding a Meta to the wp_get_archives

1) You need to include postmeta into query that you’re using for archive pages in a kind of this way: add_filter(‘getarchives_join’, ‘my_archives_join_filter’); function my_archives_join_filter($join) { if (!is_user_logged_in()) { global $wpdb; return $join . “LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)”; } return $join; } 2) You need to include condition to select a post with … Read more

Custom link text wp_get_archive link

I think the simplest way would be to use the get_archives_link filter. For example: add_filter (‘get_archives_link’, function ($link_html, $url, $text, $format, $before, $after) { if (‘with_plus’ == $format) { $link_html = “<li class=”CAPS source-bold”><a href=”https://wordpress.stackexchange.com/questions/170116/$url”>” . “<span class=”plus”>+</span> Trip $text” . ‘</a></li>’; } return $link_html; }, 10, 6); Then, in your template: <?php wp_get_archives ([‘type’ … Read more

wp_get_archives: Put span inside anchor tags

Span outside anchor tags I think you’re looking for the before and after arguments (PHP 5.4+): wp_get_archives( [ ‘before’ => ‘<span>’, ‘after’ => ‘</span>’ ] ); if you want to wrap the <span> tag around the <a> tag: <li><span><a href=”https://wordpress.stackexchange.com/questions/248311/xx”>Link text</a></span></li> Span inside anchor tags If you want it inside the anchor tags: <li><a href=”https://wordpress.stackexchange.com/questions/248311/xx”><span>Link … Read more