Passed
Push — development ( 95a828...f02a5c )
by
unknown
08:19
created
inc/enqueue.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 		wp_localize_script( 'spurs-scripts', 'spurs_loadmore_params', array(
35 35
 			'ajaxurl' => site_url() . '/wp-admin/admin-ajax.php', // WordPress AJAX
36 36
 			'posts' => json_encode( $wp_query->query_vars ), // everything about your loop is here
37
-			'current_page' => get_query_var( 'paged' ) ? get_query_var('paged') : 1,
37
+			'current_page' => get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1,
38 38
 			'max_page' => $wp_query->max_num_pages
39 39
 		) );
40 40
 	}
Please login to merge, or discard this patch.
inc/load-more.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
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">More posts</div>'; // you can use <a> as well
19 19
 	}
20 20
 }
21 21
 
22 22
 
23
-function spurs_loadmore_ajax_handler(){
23
+function spurs_loadmore_ajax_handler() {
24 24
  
25 25
 	// prepare our arguments for the query
26 26
 	$args = json_decode( stripslashes( $_POST['query'] ), true );
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	// it is always better to use WP_Query but not here
31 31
 	query_posts( $args );
32 32
  
33
-	if( have_posts() ) :
33
+	if ( have_posts() ) :
34 34
  
35 35
 		// run the loop
36
-		while( have_posts() ): the_post();
36
+		while ( have_posts() ): the_post();
37 37
  
38 38
 			// look into your theme code how the posts are inserted, but you can use your own HTML of course
39 39
 			// do you remember? - my example is adapted for Twenty Seventeen theme
@@ -50,5 +50,5 @@  discard block
 block discarded – undo
50 50
  
51 51
  
52 52
  
53
-add_action('wp_ajax_loadmore', 'spurs_loadmore_ajax_handler'); // wp_ajax_{action}
54
-add_action('wp_ajax_nopriv_loadmore', 'spurs_loadmore_ajax_handler'); // wp_ajax_nopriv_{action}
55 53
\ No newline at end of file
54
+add_action( 'wp_ajax_loadmore', 'spurs_loadmore_ajax_handler' ); // wp_ajax_{action}
55
+add_action( 'wp_ajax_nopriv_loadmore', 'spurs_loadmore_ajax_handler' ); // wp_ajax_nopriv_{action}
56 56
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,13 +14,15 @@
 block discarded – undo
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">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">More posts</div>';
19
+		}
20
+		// you can use <a> as well
19 21
 	}
20 22
 }
21 23
 
22 24
 
23
-function spurs_loadmore_ajax_handler(){
25
+function spurs_loadmore_ajax_handler() {
24 26
  
25 27
 	// prepare our arguments for the query
26 28
 	$args = json_decode( stripslashes( $_POST['query'] ), true );
Please login to merge, or discard this patch.
functions.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,23 +9,23 @@
 block discarded – undo
9 9
 defined( 'ABSPATH' ) || exit;
10 10
 
11 11
 $spurs_includes = array(
12
-	'/theme-settings.php',                  // Initialize theme default settings.
13
-	'/theme-wrapper.php',                   // Load theme wrapper.
14
-	'/setup.php',                           // Theme setup and custom theme supports.
15
-	'/widgets.php',                         // Register widget area.
16
-	'/enqueue.php',                         // Enqueue scripts and styles.
17
-	'/template-tags.php',                   // Custom template tags.
18
-	'/pagination.php',                      // Custom pagination.
19
-	'/load-more.php',                      // Custom Load More.
20
-	'/hooks.php',                           // Custom hooks.
21
-	'/extras.php',                          // Custom functions that act independently of the theme templates.
22
-	'/customizer.php',                      // Customizer additions.
23
-	'/custom-comments.php',                 // Custom comments.
24
-	'/jetpack.php',                         // Jetpack compatibility.
25
-	'/bootstrap-wp-navwalker.php',          // custom WordPress nav walker.
26
-	'/woocommerce.php',                     // WooCommerce functions.
27
-	'/editor.php',                          // Editor functions.
28
-	'/cleanup.php',                          // Editor functions.
12
+	'/theme-settings.php', // Initialize theme default settings.
13
+	'/theme-wrapper.php', // Load theme wrapper.
14
+	'/setup.php', // Theme setup and custom theme supports.
15
+	'/widgets.php', // Register widget area.
16
+	'/enqueue.php', // Enqueue scripts and styles.
17
+	'/template-tags.php', // Custom template tags.
18
+	'/pagination.php', // Custom pagination.
19
+	'/load-more.php', // Custom Load More.
20
+	'/hooks.php', // Custom hooks.
21
+	'/extras.php', // Custom functions that act independently of the theme templates.
22
+	'/customizer.php', // Customizer additions.
23
+	'/custom-comments.php', // Custom comments.
24
+	'/jetpack.php', // Jetpack compatibility.
25
+	'/bootstrap-wp-navwalker.php', // custom WordPress nav walker.
26
+	'/woocommerce.php', // WooCommerce functions.
27
+	'/editor.php', // Editor functions.
28
+	'/cleanup.php', // Editor functions.
29 29
 );
30 30
 
31 31
 foreach ( $spurs_includes as $file ) {
Please login to merge, or discard this patch.
wrapper.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	</div>
25 25
 
26 26
 <?php
27
-if( 'pagination' === get_theme_mod( 'spurs_pagination' ) ){
27
+if ( 'pagination' === get_theme_mod( 'spurs_pagination' ) ) {
28 28
 	spurs_pagination();
29 29
 } else {
30 30
 	spurs_load_more();
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 	</div>
25 25
 
26 26
 <?php
27
-if( 'pagination' === get_theme_mod( 'spurs_pagination' ) ){
27
+if( 'pagination' === get_theme_mod( 'spurs_pagination' ) ) {
28 28
 	spurs_pagination();
29 29
 } else {
30 30
 	spurs_load_more();
Please login to merge, or discard this patch.