How to create a completely functioning separate archive for posts from only 1 or 2 specific categories
How to create a completely functioning separate archive for posts from only 1 or 2 specific categories
How to create a completely functioning separate archive for posts from only 1 or 2 specific categories
You could copy the contents of your current archive page file into a new file, then tweak the functionality there into what you need it to do. At the top of the file, give it a template name like this: /* Template Name: Short Archive */ Now you can create a new page and select … Read more
You can use has_post_format to check the if the post format equal to some format type. From the docs if ( has_post_format(‘gallery’) ) { // Do something } Or use $format = get_post_format() and then do some condition.. $format = get_post_format(); if ( $format == ‘gallery’ ) { // Do something } If you want … Read more
Will answer it myself to close this question / thread. From @Sally CJ You forgot to close the if – add <?php endif; ?> after those two </div> (the closing tag for the archive-grid DIV)
I’ll answer this question myself since I found the solution after consulting with my programmer friend. Basically the code above that I posted is wrong, turns out I shouldn’t be using get_the_term_list but to use get_query_var instead. The final code is to replace the above code I posted with these code: EDIT: Change few things … Read more
You can add the following function in the functions.php of your child theme. add_filter(‘get_the_archive_title’, ‘my_get_the_archive_title’ ); function my_get_the_archive_title( $title ) { if ( is_category() ) { $title = single_cat_title( ”, false ); } elseif ( is_tag() ) { $title = single_tag_title( ”, false ); } elseif ( is_author() ) { $title=”<span class=”vcard”>” . get_the_author() . … Read more
My archives page won’t sort posts by month
PageNavi redirects to 404 when used as archive page
I had a similar issue and maybe this is also helpful when pagination is only working sometimes: e.g. /page/1/ and /page/2/ are working and /page/3/ not. Result: Error 404. Problem is: default value (12 items each page) for posts_per_page (WordPress Settings/Reading) is loaded always from database before the template is loaded. So $args=[‘posts_per_page’ => 1] … Read more
I think that you’re over engineering the problem here. If all you need to do is get the appropriate archive template, whatever that may be, then use get_archive_template() although you may need to use the {$type}_template_hierarchy filter on get_query_template() to add index.php to the possible results.