File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ Installation
30
30
31
31
Changelog
32
32
---------
33
+ 0.3 : Better page link management. Should be compatible with any URL format.
33
34
0.2 : Add option to remove link after the last results
34
35
0.1 : First version
35
36
Original file line number Diff line number Diff line change 5
5
* Description: Load the next page of posts with AJAX.
6
6
* Text Domain: byscripts_ajax_posts_loader
7
7
* Domain Path: /lang
8
- * Version: 0.2
8
+ * Version: 0.3
9
9
* Author: ByScripts
10
10
* Author URI: http://www.byscripts.info/
11
11
* License: MIT
@@ -78,7 +78,7 @@ public function init() {
78
78
array (
79
79
'page_number_next ' => $ page_number_next ,
80
80
'page_number_max ' => $ page_number_max ,
81
- 'next_link ' => next_posts ( $ page_number_max , false ),
81
+ 'page_link_model ' => get_pagenum_link ( 9999999999 ),
82
82
'load_more_str ' => __ ('Load more news ' , $ this ->identifier ),
83
83
'loading_str ' => __ ('Loading... ' , $ this ->identifier ),
84
84
'no_more_str ' => __ ('No more news to load ' , $ this ->identifier ),
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ jQuery(document).ready(function($) {
7
7
var page_number_max = parseInt ( byscripts_ajax_posts_loader . page_number_max ) ;
8
8
9
9
// The link of the next page of posts.
10
- var next_link = byscripts_ajax_posts_loader . next_link ;
10
+ var page_link_model = byscripts_ajax_posts_loader . page_link_model ;
11
11
12
12
/**
13
13
* Replace the traditional navigation with our own,
@@ -35,11 +35,12 @@ jQuery(document).ready(function($) {
35
35
// Show that we're working.
36
36
$ ( this ) . text ( byscripts_ajax_posts_loader . loading_str ) ;
37
37
38
+ var next_link = page_link_model . replace ( / 9 9 9 9 9 9 9 9 9 9 / , page_number_next ) ;
39
+
38
40
$ ( '#byscripts_ajax_posts_loader_placeholder_' + page_number_next ) . load ( next_link + ' .post' ,
39
41
function ( ) {
40
42
// Update page number and next_link.
41
43
page_number_next ++ ;
42
- next_link = next_link . replace ( / \/ p a g e \/ [ 0 - 9 ] ? / , '/page/' + page_number_next ) ;
43
44
44
45
// Add a new placeholder, for when user clicks again.
45
46
$ ( '#byscripts_ajax_posts_loader_trigger' )
@@ -55,8 +56,6 @@ jQuery(document).ready(function($) {
55
56
}
56
57
}
57
58
) ;
58
- } else if ( byscripts_ajax_posts_loader . remove_link_after_last_result ) {
59
- $ ( '#byscripts_ajax_posts_loader_trigger' ) . remove ( ) ;
60
59
}
61
60
62
61
return false ;
You can’t perform that action at this time.
0 commit comments