@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | * @link //gist.github.com/llgruff/a7ab776167aa0ed307ec445df54e5fdb |
| 24 | 24 | */ |
| 25 | 25 | if ( defined( 'AIOSEOP_VERSION' ) ) { |
| 26 | - add_action( 'get_header', function () { |
|
| 26 | + add_action( 'get_header', function() { |
|
| 27 | 27 | ob_start( |
| 28 | - function ( $o ) { |
|
| 28 | + function( $o ) { |
|
| 29 | 29 | return preg_replace( '/\n?<.*?One SEO Pack.*?>/mi', '', $o ); |
| 30 | 30 | } |
| 31 | 31 | ); |
| 32 | 32 | } ); |
| 33 | - add_action( 'wp_head', function () { |
|
| 33 | + add_action( 'wp_head', function() { |
|
| 34 | 34 | ob_end_flush(); |
| 35 | 35 | }, 999 ); |
| 36 | 36 | } |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | * @link //gist.github.com/paulcollett/4c81c4f6eb85334ba076 |
| 42 | 42 | */ |
| 43 | 43 | if ( defined( 'WPSEO_VERSION' ) ) { |
| 44 | - add_action( 'get_header', function () { |
|
| 44 | + add_action( 'get_header', function() { |
|
| 45 | 45 | ob_start( |
| 46 | - function ( $o ) { |
|
| 46 | + function( $o ) { |
|
| 47 | 47 | return preg_replace( '/^<!--.*?[Y]oast.*?-->$/mi', '', $o ); |
| 48 | 48 | } |
| 49 | 49 | ); |
| 50 | 50 | } ); |
| 51 | - add_action( 'wp_head', function () { |
|
| 51 | + add_action( 'wp_head', function() { |
|
| 52 | 52 | ob_end_flush(); |
| 53 | 53 | }, 999 ); |
| 54 | 54 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $network_active = false; |
| 62 | 62 | if ( is_multisite() ) { |
| 63 | 63 | $plugins = get_site_option( 'active_sitewide_plugins' ); |
| 64 | - if ( isset( $plugins[ $plugin ] ) ) { |
|
| 64 | + if ( isset( $plugins[$plugin] ) ) { |
|
| 65 | 65 | $network_active = true; |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | if ( isgabmi_active( 'google-analytics-for-wordpress/googleanalytics.php' ) || isgabmi_active( 'google-analytics-premium/googleanalytics.php' ) ) { |
| 73 | - add_action( 'get_header', function () { |
|
| 74 | - ob_start( function ( $o ) { |
|
| 73 | + add_action( 'get_header', function() { |
|
| 74 | + ob_start( function( $o ) { |
|
| 75 | 75 | return preg_replace( '/\n?<.*?monsterinsights.*?>/mi', '', $o ); |
| 76 | 76 | } ); |
| 77 | 77 | } ); |
| 78 | - add_action( 'wp_head', function () { |
|
| 78 | + add_action( 'wp_head', function() { |
|
| 79 | 79 | ob_end_flush(); |
| 80 | 80 | }, 999 ); |
| 81 | 81 | } |
@@ -30,28 +30,28 @@ discard block |
||
| 30 | 30 | <h2 class="comments-title"> |
| 31 | 31 | |
| 32 | 32 | <?php |
| 33 | - $comments_number = get_comments_number(); |
|
| 34 | - if ( 1 === (int) $comments_number ) { |
|
| 35 | - printf( |
|
| 36 | - /* translators: %s: post title */ |
|
| 37 | - esc_html_x( 'One thought on “%s”', 'comments title', 'spurs' ), |
|
| 38 | - '<span>' . get_the_title() . '</span>' |
|
| 39 | - ); |
|
| 40 | - } else { |
|
| 41 | - printf( // WPCS: XSS OK. |
|
| 42 | - /* translators: 1: number of comments, 2: post title */ |
|
| 43 | - esc_html( _nx( |
|
| 44 | - '%1$s thought on “%2$s”', |
|
| 45 | - '%1$s thoughts on “%2$s”', |
|
| 46 | - $comments_number, |
|
| 47 | - 'comments title', |
|
| 48 | - 'spurs' |
|
| 49 | - ) ), |
|
| 50 | - number_format_i18n( $comments_number ), |
|
| 51 | - '<span>' . get_the_title() . '</span>' |
|
| 52 | - ); |
|
| 53 | - } |
|
| 54 | - ?> |
|
| 33 | + $comments_number = get_comments_number(); |
|
| 34 | + if ( 1 === (int) $comments_number ) { |
|
| 35 | + printf( |
|
| 36 | + /* translators: %s: post title */ |
|
| 37 | + esc_html_x( 'One thought on “%s”', 'comments title', 'spurs' ), |
|
| 38 | + '<span>' . get_the_title() . '</span>' |
|
| 39 | + ); |
|
| 40 | + } else { |
|
| 41 | + printf( // WPCS: XSS OK. |
|
| 42 | + /* translators: 1: number of comments, 2: post title */ |
|
| 43 | + esc_html( _nx( |
|
| 44 | + '%1$s thought on “%2$s”', |
|
| 45 | + '%1$s thoughts on “%2$s”', |
|
| 46 | + $comments_number, |
|
| 47 | + 'comments title', |
|
| 48 | + 'spurs' |
|
| 49 | + ) ), |
|
| 50 | + number_format_i18n( $comments_number ), |
|
| 51 | + '<span>' . get_the_title() . '</span>' |
|
| 52 | + ); |
|
| 53 | + } |
|
| 54 | + ?> |
|
| 55 | 55 | |
| 56 | 56 | </h2><!-- .comments-title --> |
| 57 | 57 | |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | <?php if ( get_previous_comments_link() ) { ?> |
| 65 | 65 | <div class="nav-previous"><?php previous_comments_link( __( '← Older Comments', |
| 66 | - 'spurs' ) ); ?></div> |
|
| 66 | + 'spurs' ) ); ?></div> |
|
| 67 | 67 | <?php } |
| 68 | - if ( get_next_comments_link() ) { ?> |
|
| 68 | + if ( get_next_comments_link() ) { ?> |
|
| 69 | 69 | <div class="nav-next"><?php next_comments_link( __( 'Newer Comments →', |
| 70 | - 'spurs' ) ); ?></div> |
|
| 70 | + 'spurs' ) ); ?></div> |
|
| 71 | 71 | <?php } ?> |
| 72 | 72 | |
| 73 | 73 | </nav><!-- #comment-nav-above --> |
@@ -76,11 +76,11 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | <ol class="comment-list" style="list-style: none"> |
| 78 | 78 | <?php |
| 79 | - wp_list_comments( array( |
|
| 80 | - 'style' => 'ol', |
|
| 81 | - 'short_ping' => true, |
|
| 82 | - ) ); |
|
| 83 | - ?> |
|
| 79 | + wp_list_comments( array( |
|
| 80 | + 'style' => 'ol', |
|
| 81 | + 'short_ping' => true, |
|
| 82 | + ) ); |
|
| 83 | + ?> |
|
| 84 | 84 | </ol><!-- .comment-list --> |
| 85 | 85 | |
| 86 | 86 | <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // are there comments to navigate through. ?> |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | <?php if ( get_previous_comments_link() ) { ?> |
| 93 | 93 | <div class="nav-previous"><?php previous_comments_link( __( '← Older Comments', |
| 94 | - 'spurs' ) ); ?></div> |
|
| 94 | + 'spurs' ) ); ?></div> |
|
| 95 | 95 | <?php } |
| 96 | - if ( get_next_comments_link() ) { ?> |
|
| 96 | + if ( get_next_comments_link() ) { ?> |
|
| 97 | 97 | <div class="nav-next"><?php next_comments_link( __( 'Newer Comments →', |
| 98 | - 'spurs' ) ); ?></div> |
|
| 98 | + 'spurs' ) ); ?></div> |
|
| 99 | 99 | <?php } ?> |
| 100 | 100 | |
| 101 | 101 | </nav><!-- #comment-nav-below --> |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | <?php endif; // endif have_comments(). ?> |
| 106 | 106 | |
| 107 | 107 | <?php |
| 108 | - // If comments are closed and there are comments, let's leave a little note, shall we? |
|
| 109 | - if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
|
| 108 | + // If comments are closed and there are comments, let's leave a little note, shall we? |
|
| 109 | + if ( ! comments_open() && '0' != get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?> |
|
| 110 | 110 | <p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'spurs' ); ?></p> |
| 111 | 111 | <?php endif; ?> |
| 112 | 112 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | <?php |
| 33 | 33 | $comments_number = get_comments_number(); |
| 34 | - if ( 1 === (int) $comments_number ) { |
|
| 34 | + if ( 1 === ( int ) $comments_number ) { |
|
| 35 | 35 | printf( |
| 36 | 36 | /* translators: %s: post title */ |
| 37 | 37 | esc_html_x( 'One thought on “%s”', 'comments title', 'spurs' ), |
@@ -48,24 +48,24 @@ |
||
| 48 | 48 | <ul> |
| 49 | 49 | <!-- The Loop --> |
| 50 | 50 | <?php if ( have_posts() ) : |
| 51 | - while ( have_posts() ) : the_post(); ?> |
|
| 51 | + while ( have_posts() ) : the_post(); ?> |
|
| 52 | 52 | <li> |
| 53 | 53 | <?php |
| 54 | - printf( |
|
| 55 | - '<a rel="bookmark" href="%1$s" title="%2$s %3$s">%3$s</a>', |
|
| 56 | - esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) ), |
|
| 57 | - esc_attr( __( 'Permanent Link:', 'spurs' ) ), |
|
| 58 | - the_title( '', '', false ) |
|
| 59 | - ); |
|
| 60 | - spurs_posted_on(); |
|
| 61 | - esc_html_e( 'in', 'spurs' ); |
|
| 62 | - the_category( '&' ); |
|
| 63 | - ?> |
|
| 54 | + printf( |
|
| 55 | + '<a rel="bookmark" href="%1$s" title="%2$s %3$s">%3$s</a>', |
|
| 56 | + esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) ), |
|
| 57 | + esc_attr( __( 'Permanent Link:', 'spurs' ) ), |
|
| 58 | + the_title( '', '', false ) |
|
| 59 | + ); |
|
| 60 | + spurs_posted_on(); |
|
| 61 | + esc_html_e( 'in', 'spurs' ); |
|
| 62 | + the_category( '&' ); |
|
| 63 | + ?> |
|
| 64 | 64 | </li> |
| 65 | 65 | <?php endwhile; |
| 66 | - else : |
|
| 67 | - get_template_part( 'templates/loop/content', 'none' ); |
|
| 68 | - endif; ?> |
|
| 66 | + else : |
|
| 67 | + get_template_part( 'templates/loop/content', 'none' ); |
|
| 68 | + endif; ?> |
|
| 69 | 69 | <!-- End Loop --> |
| 70 | 70 | </ul> |
| 71 | 71 | </div> |
@@ -63,8 +63,10 @@ |
||
| 63 | 63 | ?> |
| 64 | 64 | </li> |
| 65 | 65 | <?php endwhile; |
| 66 | - else : |
|
| 66 | + else { |
|
| 67 | + : |
|
| 67 | 68 | get_template_part( 'templates/loop/content', 'none' ); |
| 69 | + } |
|
| 68 | 70 | endif; ?> |
| 69 | 71 | <!-- End Loop --> |
| 70 | 72 | </ul> |
@@ -9,24 +9,24 @@ |
||
| 9 | 9 | defined( 'ABSPATH' ) || exit; |
| 10 | 10 | |
| 11 | 11 | $spurs_includes = array( |
| 12 | - '/custom-cpt.php', // Initialize theme default settings. |
|
| 13 | - '/theme-settings.php', // Initialize theme default settings. |
|
| 14 | - '/theme-wrapper.php', // Load theme wrapper. |
|
| 15 | - '/setup.php', // Theme setup and custom theme supports. |
|
| 16 | - '/widgets.php', // Register widget area. |
|
| 17 | - '/enqueue.php', // Enqueue scripts and styles. |
|
| 18 | - '/template-tags.php', // Custom template tags. |
|
| 19 | - '/pagination.php', // Custom pagination. |
|
| 20 | - '/load-more.php', // Custom Load More. |
|
| 21 | - '/hooks.php', // Custom hooks. |
|
| 22 | - '/extras.php', // Custom functions that act independently of the theme templates. |
|
| 23 | - '/customizer.php', // Customizer additions. |
|
| 24 | - '/custom-comments.php', // Custom comments. |
|
| 25 | - '/jetpack.php', // Jetpack compatibility. |
|
| 26 | - '/bootstrap-wp-navwalker.php', // custom WordPress nav walker. |
|
| 27 | - '/woocommerce.php', // WooCommerce functions. |
|
| 28 | - '/editor.php', // Editor functions. |
|
| 29 | - '/cleanup.php', // Editor functions. |
|
| 12 | + '/custom-cpt.php', // Initialize theme default settings. |
|
| 13 | + '/theme-settings.php', // Initialize theme default settings. |
|
| 14 | + '/theme-wrapper.php', // Load theme wrapper. |
|
| 15 | + '/setup.php', // Theme setup and custom theme supports. |
|
| 16 | + '/widgets.php', // Register widget area. |
|
| 17 | + '/enqueue.php', // Enqueue scripts and styles. |
|
| 18 | + '/template-tags.php', // Custom template tags. |
|
| 19 | + '/pagination.php', // Custom pagination. |
|
| 20 | + '/load-more.php', // Custom Load More. |
|
| 21 | + '/hooks.php', // Custom hooks. |
|
| 22 | + '/extras.php', // Custom functions that act independently of the theme templates. |
|
| 23 | + '/customizer.php', // Customizer additions. |
|
| 24 | + '/custom-comments.php', // Custom comments. |
|
| 25 | + '/jetpack.php', // Jetpack compatibility. |
|
| 26 | + '/bootstrap-wp-navwalker.php', // custom WordPress nav walker. |
|
| 27 | + '/woocommerce.php', // WooCommerce functions. |
|
| 28 | + '/editor.php', // Editor functions. |
|
| 29 | + '/cleanup.php', // Editor functions. |
|
| 30 | 30 | ); |
| 31 | 31 | |
| 32 | 32 | foreach ( $spurs_includes as $file ) { |
@@ -286,7 +286,7 @@ |
||
| 286 | 286 | $html .= 'col-md-3 widget-area'; |
| 287 | 287 | echo $html; // WPCS: XSS OK. |
| 288 | 288 | } elseif ( ( is_page_template( 'page-templates/sidebar-left.php' ) && is_active_sidebar( 'sidebar-left' ) ) || |
| 289 | - ( is_page_template( 'page-templates/sidebar-right.php' ) && is_active_sidebar( 'sidebar-right' ) ) ) { |
|
| 289 | + ( is_page_template( 'page-templates/sidebar-right.php' ) && is_active_sidebar( 'sidebar-right' ) ) ) { |
|
| 290 | 290 | $html .= 'col-md-4 widget-area'; |
| 291 | 291 | echo $html; // WPCS: XSS OK. |
| 292 | 292 | } elseif ( ( 'right' === $spurs_sidebar_position || 'left' === $spurs_sidebar_position ) && ( is_active_sidebar( 'sidebar-right' ) || is_active_sidebar( 'sidebar-left' ) ) ) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | ); |
| 61 | 61 | echo $posted_on . $byline; |
| 62 | 62 | if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { |
| 63 | - echo $updated_on;// WPCS: XSS OK. |
|
| 63 | + echo $updated_on; // WPCS: XSS OK. |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * <div class="<?php spurs_column_classes(); ?>" id="primary"> |
| 249 | 249 | */ |
| 250 | 250 | function spurs_column_classes() { |
| 251 | - $html = ''; |
|
| 251 | + $html = ''; |
|
| 252 | 252 | |
| 253 | 253 | if ( is_page_template( 'page-templates/sidebar-left.php' ) && is_active_sidebar( 'sidebar-left' ) ) { |
| 254 | 254 | $html .= 'col-md-8 left-sidebar-template'; |
@@ -264,13 +264,12 @@ |
||
| 264 | 264 | */ |
| 265 | 265 | |
| 266 | 266 | //add_action( 'init', 'spurs_register_cpt_taxonomies'); |
| 267 | -function spurs_register_cpt_taxonomies() |
|
| 268 | -{ |
|
| 267 | +function spurs_register_cpt_taxonomies() { |
|
| 269 | 268 | spurs_register_cpts(); |
| 270 | 269 | spurs_register_taxonomies(); |
| 271 | 270 | } |
| 272 | 271 | |
| 273 | -function spurs_register_cpts(){ |
|
| 272 | +function spurs_register_cpts() { |
|
| 274 | 273 | |
| 275 | 274 | $cpts[] = array( |
| 276 | 275 | 'name' => 'report', |
@@ -182,15 +182,15 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | function bg($img, $size = '', $echo = true, $additional_style = '') { |
| 184 | 184 | if ( ! $img ) { |
| 185 | - $uploads = wp_get_upload_dir(); |
|
| 186 | - $url = $uploads['baseurl'] . '/path_to_fallback_image.png'; // default placeholder image |
|
| 185 | + $uploads = wp_get_upload_dir(); |
|
| 186 | + $url = $uploads['baseurl'] . '/path_to_fallback_image.png'; // default placeholder image |
|
| 187 | 187 | } else { |
| 188 | - if ( is_array( $img ) ) { |
|
| 189 | - $url = $size ? $img['sizes'][ $size ] : $img['url']; |
|
| 190 | - } else { |
|
| 191 | - $url = $img; |
|
| 192 | - } |
|
| 193 | - } |
|
| 188 | + if ( is_array( $img ) ) { |
|
| 189 | + $url = $size ? $img['sizes'][ $size ] : $img['url']; |
|
| 190 | + } else { |
|
| 191 | + $url = $img; |
|
| 192 | + } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | 195 | /*if (strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false) { |
| 196 | 196 | |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | |
| 347 | 347 | function spurs_register_cpts(){ |
| 348 | 348 | |
| 349 | - $cpts[] = array( |
|
| 349 | + $cpts[] = array( |
|
| 350 | 350 | 'name' => 'report', |
| 351 | 351 | 'names' => array( |
| 352 | 352 | 'singular' => 'report', |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | foreach ( $classes as $key => $value ) { |
| 51 | 51 | if ( 'tag' == $value ) { |
| 52 | - unset( $classes[ $key ] ); |
|
| 52 | + unset( $classes[$key] ); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
@@ -180,13 +180,13 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | if ( ! function_exists( 'bg' ) ) { |
| 182 | 182 | |
| 183 | - function bg($img, $size = '', $echo = true, $additional_style = '') { |
|
| 183 | + function bg( $img, $size = '', $echo = true, $additional_style = '' ) { |
|
| 184 | 184 | if ( ! $img ) { |
| 185 | 185 | $uploads = wp_get_upload_dir(); |
| 186 | 186 | $url = $uploads['baseurl'] . '/path_to_fallback_image.png'; // default placeholder image |
| 187 | 187 | } else { |
| 188 | 188 | if ( is_array( $img ) ) { |
| 189 | - $url = $size ? $img['sizes'][ $size ] : $img['url']; |
|
| 189 | + $url = $size ? $img['sizes'][$size] : $img['url']; |
|
| 190 | 190 | } else { |
| 191 | 191 | $url = $img; |
| 192 | 192 | } |
@@ -313,18 +313,18 @@ discard block |
||
| 313 | 313 | return $terms[0]; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | -function spurs_get_excerpt_by_post($id, $length = 70) { |
|
| 316 | +function spurs_get_excerpt_by_post( $id, $length = 70 ) { |
|
| 317 | 317 | |
| 318 | - $content = get_the_content($id); |
|
| 318 | + $content = get_the_content( $id ); |
|
| 319 | 319 | |
| 320 | - if (null !== get_the_excerpt($id) && '' !== get_the_excerpt($id)) { |
|
| 321 | - $content = get_the_excerpt($id); |
|
| 320 | + if ( null !== get_the_excerpt( $id ) && '' !== get_the_excerpt( $id ) ) { |
|
| 321 | + $content = get_the_excerpt( $id ); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - $content = strip_tags($content, '<ul><li>'); |
|
| 325 | - $content = strip_shortcodes($content); |
|
| 326 | - if ( strlen($content) > $length ) { |
|
| 327 | - return substr($content, 0, $length) . '[..]'; |
|
| 324 | + $content = strip_tags( $content, '<ul><li>' ); |
|
| 325 | + $content = strip_shortcodes( $content ); |
|
| 326 | + if ( strlen( $content ) > $length ) { |
|
| 327 | + return substr( $content, 0, $length ) . '[..]'; |
|
| 328 | 328 | } else { |
| 329 | 329 | return $content; |
| 330 | 330 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | spurs_register_taxonomies(); |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | -function spurs_register_cpts(){ |
|
| 347 | +function spurs_register_cpts() { |
|
| 348 | 348 | |
| 349 | 349 | $cpts[] = array( |
| 350 | 350 | 'name' => 'report', |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if ( ! class_exists('Spurs_CPT_Creator') ) { |
|
| 4 | - class Spurs_CPT_Creator{ |
|
| 3 | +if ( ! class_exists( 'Spurs_CPT_Creator' ) ) { |
|
| 4 | + class Spurs_CPT_Creator { |
|
| 5 | 5 | |
| 6 | 6 | public function register_cpt( $post_type, $names, $icon ) { |
| 7 | 7 | |
| 8 | - $args = [ |
|
| 8 | + $args = [ |
|
| 9 | 9 | 'labels' => [ |
| 10 | 10 | 'name' => $names['uc_plural'], |
| 11 | 11 | 'all_items' => $names['uc_plural'], |
@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | 'public' => true, |
| 25 | 25 | 'query_var' => true, |
| 26 | 26 | 'rewrite' => array( 'slug' => $names['single'], 'with_front' => false ), |
| 27 | - 'menu_icon' => 'dashicons-'.$icon, |
|
| 27 | + 'menu_icon' => 'dashicons-' . $icon, |
|
| 28 | 28 | 'has_archive' => true, |
| 29 | 29 | 'can_export' => true, |
| 30 | - 'supports' => [ 'title', 'editor', 'thumbnail', 'excerpt' ], |
|
| 30 | + 'supports' => ['title', 'editor', 'thumbnail', 'excerpt'], |
|
| 31 | 31 | ]; |
| 32 | 32 | |
| 33 | 33 | register_post_type( $post_type, $args ); |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! class_exists('Spurs_CPT_Creator') ) { |
| 4 | - class Spurs_CPT_Creator{ |
|
| 4 | + class Spurs_CPT_Creator { |
|
| 5 | 5 | |
| 6 | 6 | public function register_cpt( $post_type, $names, $icon ) { |
| 7 | 7 | |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | global $wp_query; // you can remove this line if everything works for you |
| 15 | 15 | |
| 16 | 16 | // don't display the button if there are not enough posts |
| 17 | - if ( $wp_query->max_num_pages > 1 ) |
|
| 17 | + if ( $wp_query->max_num_pages > 1 ) |
|
| 18 | 18 | echo '<div class="spurs_loadmore btn btn-primary btn-lg mx-auto w-25">More posts</div>'; // you can use <a> as well |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | global $wp_query; |
| 25 | 25 | |
| 26 | 26 | // In most cases it is already included on the page and this line can be removed |
| 27 | - wp_enqueue_script('jquery'); |
|
| 27 | + wp_enqueue_script( 'jquery' ); |
|
| 28 | 28 | |
| 29 | 29 | // register our main script but do not enqueue it yet |
| 30 | 30 | //wp_register_script( 'my_loadmore', get_stylesheet_directory_uri() . '/js/myloadmore.js', array('jquery') ); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | wp_localize_script( 'spurs-scripts', 'spurs_loadmore_params', array( |
| 36 | 36 | 'ajaxurl' => site_url() . '/wp-admin/admin-ajax.php', // WordPress AJAX |
| 37 | 37 | 'posts' => json_encode( $wp_query->query_vars ), // everything about your loop is here |
| 38 | - 'current_page' => get_query_var( 'paged' ) ? get_query_var('paged') : 1, |
|
| 38 | + 'current_page' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1, |
|
| 39 | 39 | 'max_page' => $wp_query->max_num_pages |
| 40 | 40 | ) ); |
| 41 | 41 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | add_action( 'wp_enqueue_scripts', 'jd_my_load_more_scripts' ); |
| 45 | 45 | |
| 46 | -function spurs_loadmore_ajax_handler(){ |
|
| 46 | +function spurs_loadmore_ajax_handler() { |
|
| 47 | 47 | |
| 48 | 48 | // prepare our arguments for the query |
| 49 | 49 | $args = json_decode( stripslashes( $_POST['query'] ), true ); |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | // it is always better to use WP_Query but not here |
| 55 | 55 | query_posts( $args ); |
| 56 | 56 | |
| 57 | - if( have_posts() ) : |
|
| 57 | + if ( have_posts() ) : |
|
| 58 | 58 | |
| 59 | 59 | // run the loop |
| 60 | - while( have_posts() ): the_post(); |
|
| 60 | + while ( have_posts() ): the_post(); |
|
| 61 | 61 | |
| 62 | 62 | // look into your theme code how the posts are inserted, but you can use your own HTML of course |
| 63 | 63 | // do you remember? - my example is adapted for Twenty Seventeen theme |
| 64 | - if( true == $search_page ){ |
|
| 64 | + if ( true == $search_page ) { |
|
| 65 | 65 | get_template_part( 'templates/loop/content', 'search' ); |
| 66 | 66 | } else { |
| 67 | 67 | get_template_part( 'templates/loop/content', get_post_format() ); |
@@ -75,5 +75,5 @@ discard block |
||
| 75 | 75 | endif; |
| 76 | 76 | die; // here we exit the script and even no wp_reset_query() required! |
| 77 | 77 | } |
| 78 | -add_action('wp_ajax_loadmore', 'spurs_loadmore_ajax_handler'); // wp_ajax_{action} |
|
| 79 | -add_action('wp_ajax_nopriv_loadmore', 'spurs_loadmore_ajax_handler'); // wp_ajax_nopriv_{action} |
|
| 80 | 78 | \ No newline at end of file |
| 79 | +add_action( 'wp_ajax_loadmore', 'spurs_loadmore_ajax_handler' ); // wp_ajax_{action} |
|
| 80 | +add_action( 'wp_ajax_nopriv_loadmore', 'spurs_loadmore_ajax_handler' ); // wp_ajax_nopriv_{action} |
|
| 81 | 81 | \ No newline at end of file |
@@ -14,8 +14,10 @@ discard block |
||
| 14 | 14 | global $wp_query; // you can remove this line if everything works for you |
| 15 | 15 | |
| 16 | 16 | // don't display the button if there are not enough posts |
| 17 | - if ( $wp_query->max_num_pages > 1 ) |
|
| 18 | - echo '<div class="spurs_loadmore btn btn-primary btn-lg mx-auto w-25">More posts</div>'; // you can use <a> as well |
|
| 17 | + if ( $wp_query->max_num_pages > 1 ) { |
|
| 18 | + echo '<div class="spurs_loadmore btn btn-primary btn-lg mx-auto w-25">More posts</div>'; |
|
| 19 | + } |
|
| 20 | + // you can use <a> as well |
|
| 19 | 21 | } |
| 20 | 22 | } |
| 21 | 23 | |
@@ -43,7 +45,7 @@ discard block |
||
| 43 | 45 | } |
| 44 | 46 | add_action( 'wp_enqueue_scripts', 'jd_my_load_more_scripts' ); |
| 45 | 47 | |
| 46 | -function spurs_loadmore_ajax_handler(){ |
|
| 48 | +function spurs_loadmore_ajax_handler() { |
|
| 47 | 49 | |
| 48 | 50 | // prepare our arguments for the query |
| 49 | 51 | $args = json_decode( stripslashes( $_POST['query'] ), true ); |
@@ -61,7 +63,7 @@ discard block |
||
| 61 | 63 | |
| 62 | 64 | // look into your theme code how the posts are inserted, but you can use your own HTML of course |
| 63 | 65 | // do you remember? - my example is adapted for Twenty Seventeen theme |
| 64 | - if( true == $search_page ){ |
|
| 66 | + if( true == $search_page ) { |
|
| 65 | 67 | get_template_part( 'templates/loop/content', 'search' ); |
| 66 | 68 | } else { |
| 67 | 69 | get_template_part( 'templates/loop/content', get_post_format() ); |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | get_header( spurs_template_base() ); |
| 17 | 17 | |
| 18 | -if (!is_front_page() && function_exists('yoast_breadcrumb')) { |
|
| 19 | - yoast_breadcrumb('<div id="breadcrumbs">', '</div>'); |
|
| 18 | +if ( ! is_front_page() && function_exists( 'yoast_breadcrumb' ) ) { |
|
| 19 | + yoast_breadcrumb( '<div id="breadcrumbs">', '</div>' ); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | ?> |
| 23 | 23 | |
| 24 | 24 | <div id="primary" class="<?php spurs_content_classes(); ?>"> |
| 25 | 25 | |
| 26 | - <?php if ( ( is_page_template( 'page-templates/sidebar-left.php' ) || is_page_template( 'page-templates/sidebar-right.php' ) || is_page_template( 'page-templates/both-sidebars.php' ) ) && ( is_active_sidebar( 'sidebar-left' ) || is_active_sidebar( 'sidebar-right' ) ) ) { |
|
| 26 | + <?php if ( ( is_page_template( 'page-templates/sidebar-left.php' ) || is_page_template( 'page-templates/sidebar-right.php' ) || is_page_template( 'page-templates/both-sidebars.php' ) ) && ( is_active_sidebar( 'sidebar-left' ) || is_active_sidebar( 'sidebar-right' ) ) ) { |
|
| 27 | 27 | echo '<div class="container"><div class=row>'; |
| 28 | 28 | } ?> |
| 29 | 29 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | <?php include spurs_template_path(); ?> |
| 34 | 34 | <?php |
| 35 | 35 | |
| 36 | - if( 'pagination' === get_theme_mod( 'spurs_pagination' ) ){ |
|
| 36 | + if ( 'pagination' === get_theme_mod( 'spurs_pagination' ) ) { |
|
| 37 | 37 | spurs_pagination(); |
| 38 | 38 | } else { |
| 39 | 39 | spurs_load_more(); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | <?php spurs_right_sidebar(); ?> |
| 47 | 47 | |
| 48 | - <?php if ( ( is_page_template( 'page-templates/sidebar-left.php' ) || is_page_template( 'page-templates/sidebar-right.php' ) ) && ( is_active_sidebar( 'sidebar-left' ) || is_active_sidebar( 'sidebar-right' ) ) ) { |
|
| 48 | + <?php if ( ( is_page_template( 'page-templates/sidebar-left.php' ) || is_page_template( 'page-templates/sidebar-right.php' ) ) && ( is_active_sidebar( 'sidebar-left' ) || is_active_sidebar( 'sidebar-right' ) ) ) { |
|
| 49 | 49 | echo '</div></div>'; |
| 50 | 50 | } ?> |
| 51 | 51 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | <?php include spurs_template_path(); ?> |
| 34 | 34 | <?php |
| 35 | 35 | |
| 36 | - if( 'pagination' === get_theme_mod( 'spurs_pagination' ) ){ |
|
| 36 | + if( 'pagination' === get_theme_mod( 'spurs_pagination' ) ) { |
|
| 37 | 37 | spurs_pagination(); |
| 38 | 38 | } else { |
| 39 | 39 | spurs_load_more(); |