Completed
Pull Request — master (#133)
by Sébastien
03:02
created

ALNP_Make::add_theme_support()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 8
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Auto Load Next Post Theme Support: Make
4
 *
5
 * Applies support for The Theme Foundry Make 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_Make class.
21
 */
22 View Code Duplication
class ALNP_Make {
1 ignored issue
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
24
	/**
25
	 * Initlize Theme.
26
	 *
27
	 * @access public
28
	 * @static
29
	 */
30
	public static function init() {
31
		// Filters the repeater template location.
32
		add_filter( 'alnp_template_redirect', array( __CLASS__, 'alnp_make_template_redirect' ) );
33
34
		// Add theme support and preset the theme selectors.
35
		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
36
	} // END init()
37
38
	/**
39
	 * Filters the location of the repeater template.
40
	 *
41
	 * @access public
42
	 * @static
43
	 * @return string
44
	 */
45
	public static function alnp_make_template_redirect() {
46
		return AUTO_LOAD_NEXT_POST_FILE_PATH . '/template/theme-support/make/content-alnp.php';
47
	} // END alnp_make_template_redirect()
48
49
	/**
50
	 * Add theme support by providing the theme selectors
51
	 * to be applied once the theme is activated.
52
	 *
53
	 * @access public
54
	 * @static
55
	 */
56
	public static function add_theme_support() {
57
		add_theme_support( 'auto-load-next-post', array(
58
			'content_container'    => 'main.site-main',
59
			'title_selector'       => 'h1.entry-title',
60
			'navigation_container' => 'nav.post-navigation',
61
			'comments_container'   => 'div#comments',
62
		) );
63
	} // END add_theme_support()
64
65
} // END class
66
67
ALNP_Make::init();
68