File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 29
29
$ context ['title ' ] = single_tag_title ( '' , false );
30
30
} elseif ( is_category () ) {
31
31
$ context ['title ' ] = single_cat_title ( '' , false );
32
- array_unshift ( $ templates , 'archive- ' . get_query_var ( ' cat ' ) . '.twig ' );
32
+ array_unshift ( $ templates , 'archive- ' . get_queried_object ()-> slug . '.twig ' );
33
33
} elseif ( is_post_type_archive () ) {
34
34
$ context ['title ' ] = post_type_archive_title ( '' , false );
35
35
array_unshift ( $ templates , 'archive- ' . get_post_type () . '.twig ' );
Original file line number Diff line number Diff line change @@ -123,3 +123,18 @@ function filter_password_protected_posts( $query ) {
123
123
return $ query ;
124
124
}
125
125
add_filter ( 'pre_get_posts ' , 'filter_password_protected_posts ' );
126
+
127
+ /**
128
+ * Normalize queries for paginated archive pages to support custom permalink structures.
129
+ *
130
+ * @param array $query_string - The incoming query string to be normalized.
131
+ */
132
+ function normalize_pagination_query_strings ( $ query_string ) {
133
+ if ( isset ( $ query_string ['name ' ] ) && 'page ' === $ query_string ['name ' ] && isset ( $ query_string ['page ' ] ) ) {
134
+ unset( $ query_string ['name ' ] );
135
+ $ query_string ['paged ' ] = $ query_string ['page ' ];
136
+ }
137
+
138
+ return $ query_string ;
139
+ }
140
+ add_filter ( 'request ' , 'normalize_pagination_query_strings ' );
You can’t perform that action at this time.
0 commit comments