@@ -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(); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | <input |
34 | 34 | type="number" |
35 | 35 | id="<?php echo esc_attr( $input_id ); ?>" |
36 | - class="input-text qty text <?php echo esc_attr( join( ' ', (array) $classes ) ); ?>" |
|
36 | + class="input-text qty text <?php echo esc_attr( join( ' ', ( array ) $classes ) ); ?>" |
|
37 | 37 | step="<?php echo esc_attr( $step ); ?>" |
38 | 38 | min="<?php echo esc_attr( $min_value ); ?>" |
39 | 39 | max="<?php echo esc_attr( 0 < $max_value ? $max_value : '' ); ?>" |
@@ -95,9 +95,12 @@ |
||
95 | 95 | <input type="password" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="password" id="reg_password" autocomplete="new-password"/> |
96 | 96 | </p> |
97 | 97 | |
98 | - <?php else : ?> |
|
98 | + <?php else { |
|
99 | + : ?> |
|
99 | 100 | |
100 | - <p><?php esc_html_e( 'A password will be sent to your email address.', 'spurs' ); ?></p> |
|
101 | + <p><?php esc_html_e( 'A password will be sent to your email address.', 'spurs' ); |
|
102 | +} |
|
103 | +?></p> |
|
101 | 104 | |
102 | 105 | <?php endif; ?> |
103 | 106 |