Ready to get started?Download WordPress


Yoast Breadcrumbs
Year is not showing up in post type yearly archives (1 post)

  1. Twansparant
    Posted 1 year ago #

    Hi there,

    I'm using the Breadcrumbs function within the Yoast SEO plugin.
    In my archive page for the custom post type 'news' the post type name News shows up just fine in the breadcrumbs, but when I'm on a yearly archive, the current year 2013 doesn't get added at the end of the breadcrumbs.

    Is this possible? If not, how can I add this myself?
    These are my rewrite rules in order to get the custom post type archive working:

    /* Rewrite rules year archives */
    function wpse_rewrites_init(){
       $newsslug = 'news';
       add_rewrite_rule( $newsslug.'/([0-9]+)/?$', 'index.php?post_type=news&wpse_year=$matches[1]', 'top' );
       add_rewrite_rule( $newsslug.'/([0-9]+)/page/([0-9]{1,})/?$', 'index.php?post_type=news&wpse_year=$matches[1]&paged=$matches[2]', 'top' );
    function wpse_query_vars( $query_vars ){
        $query_vars[] = 'wpse_year';
        return $query_vars;
    add_action('init', 'wpse_rewrites_init');
    add_filter('query_vars', 'wpse_query_vars');

    Thanks, Toine


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic