Completed
Branch master (a1ca10)
by
unknown
01:49
created

ALNP_OceanWP::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 13
loc 13
rs 9.8333
c 0
b 0
f 0
1
<?php
2
/**
3
 * Auto Load Next Post Theme Support: OceanWP
4
 *
5
 * Applies support for OceanWP Theme.
6
 *
7
 * @since    1.5.8
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_OceanWP class.
21
 */
22
class ALNP_OceanWP {
23
24
	/**
25
	 * Initlize Theme.
26
	 *
27
	 * @access public
28
	 * @static
29
	 */
30 View Code Duplication
	public static function init() {
1 ignored issue
show
Duplication introduced by
This method 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...
31
		// Add theme support and preset the theme selectors.
32
		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
33
34
		// Filters the location of the repeater template.
35
		add_filter( 'alnp_template_redirect', array( __CLASS__, 'template_redirect' ) );
36
37
		// Filters the repeater template location.
38
		add_filter( 'alnp_template_location', array( __CLASS__, 'alnp_oceanwp_template_location' ) );
39
40
		// Remove Auto Load Next Post compatible post navigation.
41
		remove_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 );
42
	} // END init()
43
44
	/**
45
	 * Filters the location of the repeater template to override the default repeater template.
46
	 *
47
	 * @access public
48
	 * @return string
49
	 */
50
	public static function template_redirect() {
51
		return AUTO_LOAD_NEXT_POST_FILE_PATH . '/template/theme-support/oceanwp/content-alnp.php';
52
	} // END template_redirect()
53
54
	/**
55
	 * Filters the template location for get_template_part().
56
	 *
57
	 * @access public
58
	 * @static
59
	 */
60
	public static function alnp_oceanwp_template_location() {
61
		return 'partials/single/';
62
	} // alnp_oceanwp_template_location()
63
64
	/**
65
	 * Add theme support by providing the theme selectors
66
	 * to be applied once the theme is activated.
67
	 *
68
	 * @access public
69
	 * @static
70
	 */
71
	public static function add_theme_support() {
72
		add_theme_support( 'auto-load-next-post', array(
73
			'content_container'    => 'div.site-content',
74
			'title_selector'       => '.entry-title',
75
			'navigation_container' => 'nav.post-navigation',
76
			'comments_container'   => 'section#comments',
77
			'load_js_in_footer'    => 'no',
78
			'lock_js_in_footer'    => 'no',
79
		) );
80
	} // END add_theme_support()
81
82
} // END class
83
84
ALNP_OceanWP::init();
85