|
@@ -14,13 +14,15 @@ 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 ) |
|
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
|
|
|
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 ); |
|
@@ -38,7 +40,7 @@ discard block |
|
|
block discarded – undo |
|
38
|
40
|
|
|
39
|
41
|
// look into your theme code how the posts are inserted, but you can use your own HTML of course |
|
40
|
42
|
// do you remember? - my example is adapted for Twenty Seventeen theme |
|
41
|
|
- if( true == $search_page ){ |
|
|
43
|
+ if( true == $search_page ) { |
|
42
|
44
|
get_template_part( 'templates/loop/content', 'search' ); |
|
43
|
45
|
} else { |
|
44
|
46
|
get_template_part( 'templates/loop/content', get_post_format() ); |
Please login to merge, or discard this patch.