-
Notifications
You must be signed in to change notification settings - Fork 1
/
facetwp-monthly.php
49 lines (40 loc) · 1021 Bytes
/
facetwp-monthly.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/*
Plugin Name: FacetWP - Monthly
Plugin URI: https://github.com/petitphp/facetwp-monthly
Description: Filter your posts by monthly archive
Version: 2.0.1
Author: Clément Boirie
Author URI: https://github.com/petitphp
*/
// don't load directly
if ( ! defined( 'ABSPATH' ) ) {
die( '-1' );
}
define( 'FWP_MTLY_VER', '2.0.1' );
define( 'FWP_MTLY_URL', plugin_dir_url( __FILE__ ) );
define( 'FWP_MTLY_DIR', plugin_dir_path( __FILE__ ) );
class FWP_MTLY {
function __construct() {
add_action( 'init', array( $this, 'init' ) );
}
/**
* Intialize.
*/
function init() {
add_filter( 'facetwp_facet_types', array( $this, 'register_facet_type' ) );
}
/**
* Register the "monthly" facet type.
*
* @param array $facet_types list of registered facets
*
* @return array
*/
function register_facet_type( $facet_types ) {
include( dirname( __FILE__ ) . '/classes/monthly.php' );
$facet_types['monthly'] = new FacetWP_Facet_Monthly();
return $facet_types;
}
}
$fwp_p2p = new FWP_MTLY();