@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | |
15 | 15 | // Exit if accessed directly. |
16 | -if ( ! defined( 'ABSPATH' ) ) { |
|
16 | +if ( ! defined('ABSPATH')) { |
|
17 | 17 | exit; |
18 | 18 | } |
19 | 19 | |
@@ -26,12 +26,12 @@ discard block |
||
26 | 26 | * @version 1.5.4 |
27 | 27 | * @global WP_Query $wp_query - The object information defining the current request and determines what type of query it's dealing with. See https://codex.wordpress.org/Class_Reference/WP_Query |
28 | 28 | */ |
29 | -if ( ! function_exists( 'auto_load_next_post_template_redirect' ) ) { |
|
29 | +if ( ! function_exists('auto_load_next_post_template_redirect')) { |
|
30 | 30 | function auto_load_next_post_template_redirect() { |
31 | 31 | global $wp_query; |
32 | 32 | |
33 | 33 | // If this is not a request for alnp or a singular object then bail |
34 | - if ( ! isset( $wp_query->query_vars['alnp'] ) || ! is_singular() ) { |
|
34 | + if ( ! isset($wp_query->query_vars['alnp']) || ! is_singular()) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -40,27 +40,27 @@ discard block |
||
40 | 40 | * If theme does not have a template file for Auto Load Next Post, |
41 | 41 | * the plugin will load a default template. |
42 | 42 | */ |
43 | - $child_path = get_stylesheet_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
44 | - $template_path = get_template_directory() . '/' . AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
43 | + $child_path = get_stylesheet_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
44 | + $template_path = get_template_directory().'/'.AUTO_LOAD_NEXT_POST_TEMPLATE_PATH; |
|
45 | 45 | $default_path = AUTO_LOAD_NEXT_POST_FILE_PATH; |
46 | 46 | $template_redirect = ''; |
47 | 47 | |
48 | - if ( file_exists( $child_path . 'content-alnp.php' ) ) { |
|
49 | - $template_redirect = $child_path . 'content-alnp.php'; |
|
50 | - } else if ( file_exists( $template_path . 'content-alnp.php' ) ) { |
|
51 | - $template_redirect = $template_path . 'content-alnp.php'; |
|
52 | - } else if ( file_exists( $default_path . '/template/content-alnp.php' ) ) { |
|
53 | - $template_redirect = $default_path . '/template/content-alnp.php'; |
|
48 | + if (file_exists($child_path.'content-alnp.php')) { |
|
49 | + $template_redirect = $child_path.'content-alnp.php'; |
|
50 | + } else if (file_exists($template_path.'content-alnp.php')) { |
|
51 | + $template_redirect = $template_path.'content-alnp.php'; |
|
52 | + } else if (file_exists($default_path.'/template/content-alnp.php')) { |
|
53 | + $template_redirect = $default_path.'/template/content-alnp.php'; |
|
54 | 54 | } |
55 | 55 | |
56 | - $template_redirect = apply_filters( 'alnp_template_redirect', $template_redirect ); |
|
56 | + $template_redirect = apply_filters('alnp_template_redirect', $template_redirect); |
|
57 | 57 | |
58 | - include( $template_redirect ); |
|
58 | + include($template_redirect); |
|
59 | 59 | |
60 | 60 | exit; |
61 | 61 | } // END auto_load_next_post_template_redirect() |
62 | 62 | } |
63 | -add_action( 'template_redirect', 'auto_load_next_post_template_redirect' ); |
|
63 | +add_action('template_redirect', 'auto_load_next_post_template_redirect'); |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Adds the comments template after the post content. |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | * @since 1.4.8 |
70 | 70 | * @version 1.5.4 |
71 | 71 | */ |
72 | -if ( ! function_exists( 'auto_load_next_post_comments' ) ) { |
|
72 | +if ( ! function_exists('auto_load_next_post_comments')) { |
|
73 | 73 | function auto_load_next_post_comments() { |
74 | 74 | // If comments are open or we have at least one comment, load up the comment template. |
75 | - if ( comments_open() || get_comments_number() ) : |
|
75 | + if (comments_open() || get_comments_number()) : |
|
76 | 76 | comments_template(); |
77 | 77 | endif; |
78 | 78 | } // END auto_load_next_post_comments() |
79 | 79 | } |
80 | -add_action( 'alnp_load_after_content', 'auto_load_next_post_comments', 1, 5 ); |
|
80 | +add_action('alnp_load_after_content', 'auto_load_next_post_comments', 1, 5); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Adds the post navigation for the previous link only after the post content. |
@@ -86,16 +86,16 @@ discard block |
||
86 | 86 | * @since 1.4.8 |
87 | 87 | * @version 1.5.4 |
88 | 88 | */ |
89 | -if ( ! function_exists( 'auto_load_next_post_navigation' ) ) { |
|
89 | +if ( ! function_exists('auto_load_next_post_navigation')) { |
|
90 | 90 | function auto_load_next_post_navigation() { |
91 | 91 | ?> |
92 | 92 | <nav class="navigation post-navigation" role="navigation"> |
93 | - <span class="nav-previous"><?php previous_post_link( '%link', '<span class="meta-nav">' . _x( '←', 'Previous post link', 'auto-load-next-post' ) . '</span> %title' ); ?></span> |
|
93 | + <span class="nav-previous"><?php previous_post_link('%link', '<span class="meta-nav">'._x('←', 'Previous post link', 'auto-load-next-post').'</span> %title'); ?></span> |
|
94 | 94 | </nav> |
95 | 95 | <?php |
96 | 96 | } // END auto_load_next_post_navigation() |
97 | 97 | } |
98 | -add_action( 'alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10 ); |
|
98 | +add_action('alnp_load_after_content', 'auto_load_next_post_navigation', 1, 10); |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * Returns the permalink of a random page |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $post_type - Default is post. |
105 | 105 | * @return int|boolean |
106 | 106 | */ |
107 | -if ( ! function_exists( 'alnp_get_random_page_permalink' ) ) { |
|
108 | - function alnp_get_random_page_permalink( $post_type = 'post' ) { |
|
107 | +if ( ! function_exists('alnp_get_random_page_permalink')) { |
|
108 | + function alnp_get_random_page_permalink($post_type = 'post') { |
|
109 | 109 | $args = array( |
110 | 110 | 'post_type' => $post_type, |
111 | 111 | 'post_status' => 'publish', |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | 'posts_per_page' => 1 |
114 | 114 | ); |
115 | 115 | |
116 | - $query = new WP_Query( $args ); |
|
116 | + $query = new WP_Query($args); |
|
117 | 117 | |
118 | - if ( $query->have_posts() ) { |
|
119 | - while ( $query->have_posts() ) : $query->the_post(); |
|
118 | + if ($query->have_posts()) { |
|
119 | + while ($query->have_posts()) : $query->the_post(); |
|
120 | 120 | $id = get_the_ID(); |
121 | 121 | |
122 | - return get_permalink( $id ); |
|
122 | + return get_permalink($id); |
|
123 | 123 | endwhile; |
124 | 124 | } else { |
125 | 125 | return false; |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | * @since 1.5.7 |
134 | 134 | * @return boolean |
135 | 135 | */ |
136 | -if ( ! function_exists( 'alnp_load_js_in_footer' ) ) { |
|
136 | +if ( ! function_exists('alnp_load_js_in_footer')) { |
|
137 | 137 | function alnp_load_js_in_footer() { |
138 | - $load_in_footer = get_option( 'auto_load_next_post_load_js_in_footer', false ); |
|
138 | + $load_in_footer = get_option('auto_load_next_post_load_js_in_footer', false); |
|
139 | 139 | |
140 | - if ( isset( $load_in_footer ) && $load_in_footer == 'yes' ) { |
|
140 | + if (isset($load_in_footer) && $load_in_footer == 'yes') { |
|
141 | 141 | return true; |
142 | 142 | } |
143 | 143 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @since 1.5.11 |
153 | 153 | * @return array |
154 | 154 | */ |
155 | -if ( ! function_exists( 'alnp_get_admin_screens' ) ) { |
|
155 | +if ( ! function_exists('alnp_get_admin_screens')) { |
|
156 | 156 | function alnp_get_admin_screens() { |
157 | 157 | return array( |
158 | 158 | 'dashboard', |