https://github.com/beapi/facetwp-yearly
Filter your posts by yearly archive
https://github.com/beapi/facetwp-yearly
Last synced: 6 months ago
JSON representation
Filter your posts by yearly archive
- Host: GitHub
- URL: https://github.com/beapi/facetwp-yearly
- Owner: BeAPI
- Created: 2021-02-22T14:11:40.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-08T13:57:49.000Z (about 1 year ago)
- Last Synced: 2025-06-14T00:16:09.107Z (7 months ago)
- Language: PHP
- Size: 25.4 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# FacetWP -Yearly
Custom yearly source index
# Requirements
- Require [WordPress](https://wordpress.org/) 4.7+ / Tested up to 5.6.1
- Require PHP 5.6
- [FacetWP](https://facetwp.com/) 3.7.2+
# Installation
First activate FacetWP.
Then activate FacetWP - Yearly to create your yearly facet.
Create a Facet, for example a Select Facet, and choose "Yearly archive" as Data source.

# Tips
By default, years are sorted by chronological order. If you want to reverse this order, you can use this snippet :
```
add_filter( 'facetwp_facet_orderby', 'sort_yearly_desc', 10, 2 );
function sort_yearly_desc( $orderby, $facet ) {
if ( 'YOUR_FACET_NAME' === $facet['name'] ) {
$orderby = 'f.facet_display_value DESC';
}
return $orderby;
}
```