Linux 软件免费装
Banner图

Simple Yearly Archive

开发者 Alphawolf
更新时间 2023年11月7日 00:23
捐献地址: 去捐款
PHP版本: 3.7 及以上
WordPress版本: 6.3.99
版权: GPLv2 or later
版权网址: 版权信息

标签

shortcode language yearly category wpml gettext localization archive multilingual exclude archives coauthors wp_query polyglot

下载

2.2.2 2.2.1 1.8.3 1.9.0 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2.0

详情介绍:

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: Click here for a demo Developer on Twitter Looking for more WordPress plugins? Visit www.schloebe.de/portfolio/

安装:

  1. Download the plugin and unzip it.
  2. Upload the folder simple-yearly-archive/ to your /wp-content/plugins/ folder.
  3. Activate the plugin from your Wordpress admin panel.
  4. Installation finished.
See Usage for examples, available parameters and more.

升级注意事项:

常见问题:

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

更新日志:

2.2.2 2.2.1 2.2.0 2.1.9 2.1.8 2.1.7 2.1.6 2.1.5 2.1.2 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.9.0 1.8.3 1.8.2 1.8.1 1.8.0 1.7.5 1.7.4 1.7.3 1.7.2 1.7.1.2 1.7.1.1 1.7.1 1.7.0.2 1.7.0.1 1.7.0 1.6.2.5 1.6.2.2 1.6.2.1 1.6.2 1.6.1 1.6.0 1.5.0 1.4.3.3 1.4.3.2 1.4.3.1 1.4.3 1.4.2 1.4.1 1.4 1.3.3 1.3.2 1.3.1 1.3.0 1.2.9 1.2.8 1.2.7 1.2.6 1.2.5 1.2.4 1.2.3 1.2.2 1.2.1 1.2 1.1.50 1.1.40 1.1.31 1.1.30 1.1.20 1.1.10 1.1.9 1.1.8 1.1.7 1.1.5 1.1.2 1.1.1 1.1.0 1.0.1 1.0 0.98 0.97 0.96 0.95 0.91 0.9 0.82 0.81 0.8 0.7 0.6 0.5