Completed
Pull Request — master (#133)
by Sébastien
01:53
created

ALNP_Understrap   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 43
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 7 1
A alnp_understrap_template_location() 0 3 1
A add_theme_support() 0 8 1
1
<?php
2
/**
3
 * Auto Load Next Post Theme Support: Understrap
4
 *
5
 * Applies support for Understrap Theme.
6
 *
7
 * @since    1.5.0
8
 * @author   Sébastien Dumont
9
 * @category Theme Support
10
 * @package  Auto Load Next Post/Theme Support
11
 * @license  GPL-2.0+
12
 */
13
14
// Exit if accessed directly.
15
if ( ! defined( 'ABSPATH' ) ) {
16
	exit;
17
}
18
19
/**
20
 * ALNP_Understrap class.
21
 */
22
class ALNP_Understrap {
23
24
	/**
25
	 * Initlize Theme.
26
	 *
27
	 * @access public
28
	 * @static
29
	 */
30
	public static function init() {
31
		// Add theme support and preset the theme selectors.
32
		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
33
34
		// Filters the repeater template location.
35
		add_filter( 'alnp_template_location', array( __CLASS__, 'alnp_understrap_template_location' ) );
36
	} // END init()
37
38
	/**
39
	 * Filters the template location for get_template_part().
40
	 *
41
	 * @access public
42
	 * @static
43
	 */
44
	public static function alnp_understrap_template_location() {
45
		return 'loop-templates/';
46
	} // alnp_understrap_template_location()
47
48
	/**
49
	 * Add theme support by providing the theme selectors
50
	 * to be applied once the theme is activated.
51
	 *
52
	 * @access public
53
	 * @static
54
	 */
55
	public static function add_theme_support() {
56
		add_theme_support( 'auto-load-next-post', array(
57
			'content_container'    => 'main.site-main',
58
			'title_selector'       => 'h1.entry-title',
59
			'navigation_container' => 'nav.post-navigation',
60
			'comments_container'   => 'div#comments',
61
		) );
62
	} // END add_theme_support()
63
64
} // END class
65
66
ALNP_Understrap::init();
67