@@ -16,71 +16,71 @@ |
||
16 | 16 | * @version 1.4.10 |
17 | 17 | */ |
18 | 18 | |
19 | -$template_location = apply_filters( 'alnp_template_location', '' ); // e.g. "template-parts/post/" |
|
19 | +$template_location = apply_filters('alnp_template_location', ''); // e.g. "template-parts/post/" |
|
20 | 20 | |
21 | -if ( have_posts() ) : |
|
21 | +if (have_posts()) : |
|
22 | 22 | |
23 | 23 | // Load content before the loop. |
24 | - do_action( 'alnp_load_before_loop' ); |
|
24 | + do_action('alnp_load_before_loop'); |
|
25 | 25 | |
26 | 26 | // Check that there are posts to load. |
27 | - while ( have_posts() ) : the_post(); |
|
27 | + while (have_posts()) : the_post(); |
|
28 | 28 | |
29 | 29 | $post_format = get_post_format(); // Post Format e.g. video |
30 | 30 | |
31 | 31 | $post_type = get_post_type(); // Post Type e.g. post |
32 | 32 | |
33 | 33 | // Load content before the post content. |
34 | - do_action( 'alnp_load_before_content' ); |
|
34 | + do_action('alnp_load_before_content'); |
|
35 | 35 | |
36 | 36 | // Load content before the post content for a specific post format. |
37 | - do_action( 'alnp_load_before_content_post_format_' . $post_format ); |
|
37 | + do_action('alnp_load_before_content_post_format_'.$post_format); |
|
38 | 38 | |
39 | 39 | // Load content before the post content for a specific post type. |
40 | - do_action( 'alnp_load_before_content_post_type_' . $post_type ); |
|
40 | + do_action('alnp_load_before_content_post_type_'.$post_type); |
|
41 | 41 | |
42 | - if ( false === $post_format ) { |
|
42 | + if (false === $post_format) { |
|
43 | 43 | /* |
44 | 44 | * Include the Post-Type-specific template for the content. |
45 | 45 | * content-___.php (where ___ is the Post Type name). |
46 | 46 | */ |
47 | - if ( locate_template( $template_location . 'content-' . $post_type . '.php') != '' ) { |
|
48 | - get_template_part( $template_location . 'content', $post_type ); |
|
47 | + if (locate_template($template_location.'content-'.$post_type.'.php') != '') { |
|
48 | + get_template_part($template_location.'content', $post_type); |
|
49 | 49 | } else { |
50 | 50 | // If no specific post type found then fallback to standard content.php file. |
51 | - get_template_part( $template_location . 'content' ); |
|
51 | + get_template_part($template_location.'content'); |
|
52 | 52 | } |
53 | 53 | } else { |
54 | 54 | /* |
55 | 55 | * Include the Post-Format-specific template for the content. |
56 | 56 | * called format-___.php (where ___ is the Post Format name). |
57 | 57 | */ |
58 | - if ( locate_template( $template_location . 'format-' . $post_format . '.php' ) != '' ) { |
|
59 | - get_template_part( $template_location . 'format', $post_format ); |
|
58 | + if (locate_template($template_location.'format-'.$post_format.'.php') != '') { |
|
59 | + get_template_part($template_location.'format', $post_format); |
|
60 | 60 | } else { |
61 | 61 | // If no format-{post-format}.php file found then fallback to content-{post-format}.php |
62 | - get_template_part( $template_location . 'content', $post_format ); |
|
62 | + get_template_part($template_location.'content', $post_format); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | 66 | // Load content after the post content for a specific post type. |
67 | - do_action( 'alnp_load_after_content_post_type_' . $post_type ); |
|
67 | + do_action('alnp_load_after_content_post_type_'.$post_type); |
|
68 | 68 | |
69 | 69 | // Load content after the post content for a specific post format. |
70 | - do_action( 'alnp_load_after_content_post_format_' . $post_format ); |
|
70 | + do_action('alnp_load_after_content_post_format_'.$post_format); |
|
71 | 71 | |
72 | 72 | // Load content after the post content. |
73 | - do_action( 'alnp_load_after_content' ); |
|
73 | + do_action('alnp_load_after_content'); |
|
74 | 74 | |
75 | 75 | // End the loop. |
76 | 76 | endwhile; |
77 | 77 | |
78 | 78 | // Load content after the loop. |
79 | - do_action( 'alnp_load_after_loop' ); |
|
79 | + do_action('alnp_load_after_loop'); |
|
80 | 80 | |
81 | 81 | else : |
82 | 82 | |
83 | 83 | // Load content if there are no more posts. |
84 | - do_action( 'alnp_no_more_posts' ); |
|
84 | + do_action('alnp_no_more_posts'); |
|
85 | 85 | |
86 | 86 | endif; // END if have_posts() |
@@ -78,9 +78,11 @@ |
||
78 | 78 | // Load content after the loop. |
79 | 79 | do_action( 'alnp_load_after_loop' ); |
80 | 80 | |
81 | -else : |
|
81 | +else { |
|
82 | + : |
|
82 | 83 | |
83 | 84 | // Load content if there are no more posts. |
84 | 85 | do_action( 'alnp_no_more_posts' ); |
86 | +} |
|
85 | 87 | |
86 | 88 | endif; // END if have_posts() |
@@ -13,11 +13,11 @@ 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 | |
20 | -if ( ! function_exists( 'auto_load_next_post_is_ajax' ) ) { |
|
20 | +if ( ! function_exists('auto_load_next_post_is_ajax')) { |
|
21 | 21 | /** |
22 | 22 | * Returns true when the page is loaded via ajax. |
23 | 23 | * |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | * @return bool |
27 | 27 | */ |
28 | 28 | function auto_load_next_post_is_ajax() { |
29 | - if ( defined( 'DOING_AJAX' ) ) { |
|
29 | + if (defined('DOING_AJAX')) { |
|
30 | 30 | return true; |
31 | 31 | } |
32 | 32 | |
33 | - return( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) ? true : false; |
|
33 | + return(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') ? true : false; |
|
34 | 34 | } // END auto_load_next_post_is_ajax |
35 | 35 | } |
36 | 36 | |
37 | -if ( ! function_exists( 'supports_alnp' ) ) { |
|
37 | +if ( ! function_exists('supports_alnp')) { |
|
38 | 38 | /** |
39 | 39 | * Returns true or false if Auto Load Next Post supports the theme. |
40 | 40 | * |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | 'storefront' |
54 | 54 | ); |
55 | 55 | |
56 | - $supported_themes = array_merge( $core_themes, $other_themes ); |
|
56 | + $supported_themes = array_merge($core_themes, $other_themes); |
|
57 | 57 | |
58 | - if ( in_array( get_option('template'), $supported_themes ) ) { |
|
58 | + if (in_array(get_option('template'), $supported_themes)) { |
|
59 | 59 | return true; |
60 | - } else if ( current_theme_supports( 'auto-load-next-post' ) ) { |
|
60 | + } else if (current_theme_supports('auto-load-next-post')) { |
|
61 | 61 | return true; |
62 | 62 | } |
63 | 63 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } // END supports_alnp() |
66 | 66 | } |
67 | 67 | |
68 | -if ( ! function_exists( 'alnp_template_location' ) ) { |
|
68 | +if ( ! function_exists('alnp_template_location')) { |
|
69 | 69 | /** |
70 | 70 | * Filters the template location for get_template_part(). |
71 | 71 | * |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | function alnp_template_location() { |
78 | 78 | $current_theme = get_option('template'); |
79 | 79 | |
80 | - switch( $current_theme ) { |
|
80 | + switch ($current_theme) { |
|
81 | 81 | case 'twentyseventeen': |
82 | 82 | $path = 'template-parts/post/'; |
83 | 83 | break; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | add_filter('alnp_template_location', 'alnp_template_location'); |
98 | 98 | } |
99 | 99 | |
100 | -if ( ! function_exists( 'is_alnp_pro_version_installed' ) ) { |
|
100 | +if ( ! function_exists('is_alnp_pro_version_installed')) { |
|
101 | 101 | /** |
102 | 102 | * Detects if Auto Load Next Post Pro is installed. |
103 | 103 | * |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | * @return boolen |
107 | 107 | */ |
108 | 108 | function is_alnp_pro_version_installed() { |
109 | - $active_plugins = (array) get_option( 'active_plugins', array() ); |
|
109 | + $active_plugins = (array) get_option('active_plugins', array()); |
|
110 | 110 | |
111 | - if ( is_multisite() ) { |
|
112 | - $active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) ); |
|
111 | + if (is_multisite()) { |
|
112 | + $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array())); |
|
113 | 113 | } |
114 | 114 | |
115 | - return in_array( 'auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins ) || array_key_exists( 'auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins ); |
|
115 | + return in_array('auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins) || array_key_exists('auto-load-next-post-pro/auto-load-next-post-pro.php', $active_plugins); |
|
116 | 116 | } |
117 | 117 | } |