@@ -19,7 +19,9 @@ private function __construct() {
19
19
$ this ->block_hooks ();
20
20
add_action ( 'after_setup_theme ' , array ( $ this , 'support ' ) );
21
21
add_action ( 'wp_enqueue_scripts ' , array ( $ this , 'enqueue ' ) );
22
- // Changing excerpt more
22
+ add_filter ( 'pre_get_posts ' , array ( $ this , 'pre_get_posts ' ) );
23
+
24
+ // Excerpt tweaks
23
25
add_filter ( 'excerpt_more ' , array ( $ this , 'excerpt_more ' ) );
24
26
add_filter ( 'excerpt_length ' , array ( $ this , 'excerpt_length ' ) );
25
27
}
@@ -30,6 +32,7 @@ private function __construct() {
30
32
*/
31
33
private function block_hooks () {
32
34
$ blk = Least_Blocks::instance ();
35
+ $ blk ->register_patterns ();
33
36
add_filter ( 'default_wp_template_part_areas ' , array ( $ blk , 'template_part_areas ' ) );
34
37
add_action ( 'wp_head ' , array ( $ blk , 'before_maybe_inline_styles ' ), 0 );
35
38
}
@@ -68,12 +71,23 @@ public function enqueue() {
68
71
wp_enqueue_style ( 'least-style ' , get_template_directory_uri () . '/style.css ' , array (), wp_get_theme ()->get ( 'Version ' ) );
69
72
}
70
73
74
+ /**
75
+ * @param WP_Query $query
76
+ */
77
+ public function pre_get_posts ( $ query ) {
78
+ if ( $ query ->is_main_query () ) {
79
+ $ post_archive = $ query ->is_archive () || $ query ->is_home () || $ query ->is_search ();
80
+ if ( $ post_archive ) {
81
+ $ query ->set ( 'posts_per_page ' , 12 );
82
+ }
83
+ }
84
+ }
85
+
71
86
/**
72
87
* Adds read more link
73
- * @param int $count
74
88
* @return string
75
89
*/
76
- public function excerpt_length ( $ count ) {
90
+ public function excerpt_length () {
77
91
return 25 ;
78
92
}
79
93
0 commit comments