ALNP_Poseidon   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 69
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 10 1
A the_post_thumbnail() 0 8 4
A alnp_poseidon_template_location() 0 3 1
A add_theme_support() 0 11 1
1
<?php
2
/**
3
 * Auto Load Next Post Theme Support: Poseidon
4
 *
5
 * Applies support for Poseidon Theme.
6
 *
7
 * @since    1.5.9
8
 * @version  1.6.0
9
 * @author   Sébastien Dumont
10
 * @category Theme Support
11
 * @package  Auto Load Next Post/Theme Support
12
 * @license  GPL-2.0+
13
 */
14
15
// Exit if accessed directly.
16
if ( ! defined( 'ABSPATH' ) ) {
17
	exit;
18
}
19
20
/**
21
 * ALNP_Poseidon class.
22
 */
23
class ALNP_Poseidon {
24
25
	/**
26
	 * Initlize Theme.
27
	 *
28
	 * @access public
29
	 * @static
30
	 */
31
	public static function init() {
32
		// Add theme support and preset the theme selectors.
33
		add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) );
34
35
		// Display the post thumbnail before the content.
36
		add_action( 'alnp_load_before_content', array( __CLASS__, 'the_post_thumbnail' ), 10 );
37
38
		// Filters the repeater template location.
39
		//add_filter( 'alnp_template_location', array( __CLASS__, 'alnp_poseidon_template_location' ) );
40
	} // END init()
41
42
	/**
43
	 * Display the post thumbnail before the content if the 
44
	 * theme is set to display them only in the header.
45
	 *
46
	 * @access  public
47
	 * @static
48
	 * @since   1.5.9
49
	 * @version 1.5.10
50
	 */
51
	public static function the_post_thumbnail() {
52
		// Get theme options from database.
53
		$theme_options = poseidon_theme_options();
54
55
		if ( is_single() && has_post_thumbnail() && 'header' == $theme_options['post_layout_single'] ) {
56
			the_post_thumbnail();
57
		}
58
	} // END the_post_thumbnail()
59
60
	/**
61
	 * Filters the template location for get_template_part().
62
	 *
63
	 * @access public
64
	 * @static
65
	 */
66
	public static function alnp_poseidon_template_location() {
67
		return 'template-parts/';
68
	} // alnp_poseidon_template_location()
69
70
	/**
71
	 * Add theme support by providing the theme selectors
72
	 * to be applied once the theme is activated.
73
	 *
74
	 * @access  public
75
	 * @static
76
	 * @since   1.5.9
77
	 * @version 1.6.0
78
	 */
79
	public static function add_theme_support() {
80
		add_theme_support( 'auto-load-next-post', array(
81
			'content_container'    => 'main.site-main',
82
			'title_selector'       => 'h1.entry-title',
83
			'navigation_container' => 'nav.post-navigation',
84
			'comments_container'   => 'div#comments',
85
			'load_js_in_footer'    => 'no',
86
			'lock_js_in_footer'    => 'no',
87
			'directory_post'       => 'template-parts/'
88
		) );
89
	} // END add_theme_support()
90
91
} // END class
92
93
ALNP_Poseidon::init();
94