File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 2929 $ context ['title ' ] = single_tag_title ( '' , false );
3030} elseif ( is_category () ) {
3131 $ 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 ' );
3333} elseif ( is_post_type_archive () ) {
3434 $ context ['title ' ] = post_type_archive_title ( '' , false );
3535 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 ) {
123123 return $ query ;
124124}
125125add_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