1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Auto Load Next Post Theme Support: Twenty Eleven |
4
|
|
|
* |
5
|
|
|
* Applies support for WordPress Twenty Eleven 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_Twenty_Eleven class. |
21
|
|
|
*/ |
22
|
|
|
class ALNP_Twenty_Eleven { |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Initlize Theme. |
26
|
|
|
* |
27
|
|
|
* @access public |
28
|
|
|
* @static |
29
|
|
|
*/ |
30
|
|
|
public static function init() { |
31
|
|
|
// This removes the default post navigation in the repeater template. |
32
|
|
|
remove_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 ); |
33
|
|
|
|
34
|
|
|
// Add a compaitable post navigation. |
35
|
|
|
add_action( 'alnp_load_after_content', array( __CLASS__, 'alnp_twentyeleven_post_navigation' ), 1, 10 ); |
36
|
|
|
|
37
|
|
|
// Filters the repeater template location. |
38
|
|
|
add_filter( 'alnp_template_redirect', array( __CLASS__, 'alnp_twentyeleven_template_redirect' ) ); |
39
|
|
|
|
40
|
|
|
// Add theme support and preset the theme selectors. |
41
|
|
|
add_action( 'after_setup_theme', array( __CLASS__, 'add_theme_support' ) ); |
42
|
|
|
} // END init() |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Adds a compaitable post navigation. |
46
|
|
|
* |
47
|
|
|
* @access public |
48
|
|
|
* @static |
49
|
|
|
*/ |
50
|
|
|
public static function alnp_twentyeleven_post_navigation() { |
51
|
|
|
?> |
52
|
|
|
<nav id="nav-single"> |
53
|
|
|
<h3 class="assistive-text"><?php _e( 'Post navigation', 'auto-load-next-post' ); ?></h3> |
54
|
|
|
<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'auto-load-next-post' ) ); ?></span> |
55
|
|
|
</nav><!-- #nav-single --> |
56
|
|
|
<?php |
57
|
|
|
} // END alnp_twentyeleven_post_navigation() |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Filters the location of the repeater template. |
61
|
|
|
* |
62
|
|
|
* @access public |
63
|
|
|
* @static |
64
|
|
|
* @return string |
65
|
|
|
*/ |
66
|
|
|
public static function alnp_twentyeleven_template_redirect() { |
67
|
|
|
return AUTO_LOAD_NEXT_POST_FILE_PATH . '/template/theme-support/twentyeleven/content-alnp.php'; |
68
|
|
|
} // END alnp_twentyeleven_template_redirect() |
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
|
|
|
*/ |
77
|
|
|
public static function add_theme_support() { |
78
|
|
|
add_theme_support( 'auto-load-next-post', array( |
79
|
|
|
'content_container' => '#content', |
80
|
|
|
'title_selector' => 'h1.entry-title', |
81
|
|
|
'navigation_container' => '#nav-single', |
82
|
|
|
'comments_container' => 'div#comments', |
83
|
|
|
'load_js_in_footer' => 'no', |
84
|
|
|
'lock_js_in_footer' => 'no', |
85
|
|
|
) ); |
86
|
|
|
} // END add_theme_support() |
87
|
|
|
|
88
|
|
|
} // END class |
89
|
|
|
|
90
|
|
|
ALNP_Twenty_Eleven::init(); |
91
|
|
|
|