sandywp / plugins / simple-yearly-archive

Simple Yearly Archive

4.7 out of 5 stars. 4.7 30 reviews

Simple Yearly Archive is a rather neat and simple Wordpress plugin that allows you to display your archives in a year-based list.

Launch a sandbox with this plugin → No signup.
Ready in seconds.

v2.2.7 6,000+ installs WP 3.7+ PHP 7.4+

your-sandbox.sandywp.com/wp-admin
Simple Yearly Archive running inside a SandyWP sandbox

What you get inside

1 screen
  • The options page

About this plugin

Simple Yearly Archive is a rather neat and simple WordPress plugin that allows you to display your archives in a year-based list. It works mostly like the usual WP archive, but displays all published posts seperated by their year of publication. That said, it’s also possible to restrict the output to certain categories, and much more.

See Usage for examples, available parameters and more.

Included languages:

  • English
  • German (de_DE) (Thanks to me ;-))
  • German (de_DE_formal) (Thanks for contributing formal german language goes to Paul Vogel)
  • Italian (it_IT) (Thanks for contributing italian language goes to Gianni Diurno)
  • Russian (ru_RU) (Thanks for contributing russian language goes to Dimitry German)
  • Belorussian (by_BY) (Thanks for contributing belorussian language goes to Marcis Gasuns)
  • Uzbek (uz_UZ) (Thanks for contributing uzbek language goes to Alexandra Bolshova)
  • French (fr_FR) (Thanks for contributing french language goes to Jean-Michel Meyer)
  • Chinese (zh_CN) (Thanks for contributing chinese language goes to Mariana Ma)
  • Japanese (ja) (Thanks for contributing japanese language goes to Chestnut)
  • Portuguese Brazil (pt_BR) (Thanks for contributing portuguese brazil language goes to LucasTolle)
  • Dutch (nl_NL) (Thanks for contributing dutch language goes to Bart Verkerk)
  • Spanish (es) (Spanish translation by Ibidem Group)

Click here for a demo

Developer on X Developer on Bluesky

Looking for more WordPress plugins? Visit www.schloebe.de/portfolio/

Questions

Usage

You can add the archive to any post/page by using shortcode. See Usage for examples, available parameters and more.

How can I change the posts’ titles?

Just use the filter sya_the_title. Example: Add the following to your theme’s functions.php:

add_filter( 'sya_the_title', 'my_sya_filter_title', 10, 2 );

function my_sya_filter_title( $title, $id ) {
    return $id . ' - ' . $title;
}

How can I modify the post links?

Just use the filter sya_postlink. Example: Add the following to your theme’s functions.php:

add_filter( 'sya_postlink', 'sya_modify_postlinks', 10, 3 );

function sya_modify_postlinks( $link_html, $post ) {
    $dom = new DOMDocument();
    $dom->loadHtml($link_html);
    $xpath = new DOMXPath($dom);
    $link = $xpath->query("//a")->item(0);
    $link_classes = explode(' ', $link->getAttribute('class'));
    $link_classes[] = 'postyear-' . $post->post_year;
    $link->setAttribute('class', implode(' ', $link_classes));
    return $dom->saveHTML();
}

This will add a CSS class with the post year to the post links.

How can I change the posts’ authors listing (like in supporting the Co-Authors Plus plugin)?

Just use the filter sya_the_authors. Example: Add the following to your theme’s functions.php:

if( function_exists('get_coauthors') ) {
    add_filter( 'sya_the_authors', 'my_sya_filter_authors', 10, 2 );

    function my_sya_filter_authors( $author, $post ) {
        $coauthors = get_coauthors( $post->ID );
        $authorsCollection = array();
        foreach( $coauthors as $coauthor ) {
            if( $coauthor->display_name ) {
                $authorsCollection[] = $coauthor->display_name;
            }
        }
        return implode(', ', $authorsCollection);
    }
}

How can I make the posts’ categories list only show child categories?

Just use the filter sya_categories. Example: Add the following to your theme’s functions.php:

function sya_child_categories( $sya_categories ) {
    return array_filter($sya_categories, function($v, $k) {
        return get_category( $k )->parent > 0;
    }, ARRAY_FILTER_USE_BOTH);
}
add_filter( 'sya_categories', 'sya_child_categories', 10, 3 );

How can I change query parameters?

Just use the filter sya_get_posts that allows you to query for literally anything using WP_Query parameters. Add the following snippets to your theme’s functions.php.

Display posts that have “either” of these tags

add_filter( 'sya_get_posts', function() {
    return array(
        'tag' => 'bread,baking'
    );
});

Display posts that match the search term “keyword”

add_filter( 'sya_get_posts', function() {
    return array(
        's' => 'keyword'
    );
});

Display only password protected posts

add_filter( 'sya_get_posts', function() {
    return array(
        'has_password' => true
    );
});

Display only 10 posts

add_filter( 'sya_get_posts', function() {
    return array(
        'numberposts' => 10
    );
});

Display posts tagged with bob, under people custom taxonomy

add_filter( 'sya_get_posts', function() {
    return array(
        'tax_query' => array(
            array(
                'taxonomy' => 'people',
                'field'    => 'slug',
                'terms'    => 'bob',
            )
        )
    );
});

Display posts from several custom taxonomies

add_filter( 'sya_get_posts', function() {
    return array(
        'tax_query' => array(
            'relation' => 'AND',
            array(
                'taxonomy' => 'movie_genre',
                'field'    => 'slug',
                'terms'    => array( 'action', 'comedy' ),
            ),
            array(
                'taxonomy' => 'actor',
                'field'    => 'term_id',
                'terms'    => array( 103, 115, 206 ),
                'operator' => 'NOT IN',
            ),
        )
    );
});

Display posts that are in the quotes category OR have the quote format

add_filter( 'sya_get_posts', function() {
    return array(
        'tax_query' => array(
            'relation' => 'OR',
            array(
                'taxonomy' => 'category',
                'field'    => 'slug',
                'terms'    => array( 'quotes' ),
            ),
            array(
                'taxonomy' => 'post_format',
                'field'    => 'slug',
                'terms'    => array( 'post-format-quote' ),
            ),
        )
    );
});

Display posts that are in the quotes category OR both have the quote post format AND are in the wisdom category

add_filter( 'sya_get_posts', function() {
    return array(
        'tax_query' => array(
            'relation' => 'OR',
            array(
                'taxonomy' => 'category',
                'field'    => 'slug',
                'terms'    => array( 'quotes' )
            ),
            array(
                'relation' => 'AND',
                array(
                    'taxonomy' => 'post_format',
                    'field'    => 'slug',
                    'terms'    => array( 'post-format-quote' )
                ),
                array(
                    'taxonomy' => 'category',
                    'field'    => 'slug',
                    'terms'    => array( 'wisdom' ),
                )
            )
        )
    );
});

Configuration? Parameters? Head over here

4.7

30 reviews

  • 5 ★ 28
  • 4 ★ 0
  • 3 ★ 0
  • 2 ★ 0
  • 1 ★ 2

Ratings come from WordPress.org. SandyWP does not collect its own reviews.

sandywp / also on the shelf

Try another plugin

  • Jetpack VaultPress

    3.8 · 10K+ installs

    (DEPRECATED: Please install "Jetpack VaultPress Backup" instead) Jetpack VaultPress offers real-time backups, one-click restores,…

  • Zippy

    4.6 · 8K+ installs

    Incredibly easy solution to archive pages and posts as zip file and unpack them back even on the other website!

  • Posts List

    4.5 · 7K+ installs

    Adds a posts (or pages) list of your blog pages (or posts) by entering the shortcode [posts-list].

Spin up a real WordPress site in seconds.

Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.