@@ -40,17 +40,14 @@ class ByScriptsAjaxPostsLoader
40
40
public $ identifier = 'byscripts_ajax_posts_loader ' ;
41
41
42
42
public function __construct () {
43
- add_action ('template_redirect ' , array ($ this , 'init ' ));
43
+ add_action ('template_redirect ' , array ($ this , 'start ' ));
44
44
add_action ('admin_init ' , array ($ this , 'adminInit ' ));
45
45
add_action ('admin_menu ' , array ($ this , 'adminMenu ' ));
46
+ add_action ('init ' , array ($ this , 'loadTextDomain ' ));
46
47
add_filter (sprintf ('plugin_action_links_%s ' , plugin_basename (__FILE__ )), array ($ this , 'settingsLink ' ));
47
- load_plugin_textdomain ($ this ->identifier , false , dirname (plugin_basename (__FILE__ )) . '/lang/ ' );
48
-
49
- // Small hack to make the string visible in PoEdit (I18n)
50
- __ ('Load the next page of posts with AJAX. ' );
51
48
}
52
49
53
- public function init () {
50
+ public function start () {
54
51
global $ wp_query ;
55
52
56
53
// Don't load script on singular pages
@@ -70,7 +67,7 @@ public function init() {
70
67
71
68
// Next page to load
72
69
$ page_number_next = (get_query_var ('paged ' ) > 1 ) ? get_query_var ('paged ' ) + 1 : 2 ;
73
-
70
+
74
71
// Add some parameters for the JS.
75
72
wp_localize_script (
76
73
$ this ->identifier ,
@@ -89,6 +86,13 @@ public function init() {
89
86
);
90
87
}
91
88
89
+ public function loadTextDomain () {
90
+ load_plugin_textdomain ($ this ->identifier , false , dirname (plugin_basename (__FILE__ )) . '/lang/ ' );
91
+
92
+ // Small hack to make the string visible in PoEdit (I18n)
93
+ __ ('Load the next page of posts with AJAX. ' , $ this ->identifier );
94
+ }
95
+
92
96
/**
93
97
* Prefixes a string with an unique identifier
94
98
*
0 commit comments