Archive sorted by month – separate
Archive sorted by month – separate
Archive sorted by month – separate
You may be able to use get_archives_link with same parameters as wp_get_archives and either use the output from that to determine if there are no posts or there is a filter in get_archives_link called get_archives_link that gives you access to the HTML. Source: http://wpseek.com/function/get_archives_link/
Don’t name your custom page template archive.php. If you refer to the Template Hierarchy, you’ll see that archive.php is the template WordPress loads for archives if a more specific template isn’t available.
1) You need to include postmeta into query that you’re using for archive pages in a kind of this way: add_filter(‘getarchives_join’, ‘my_archives_join_filter’); function my_archives_join_filter($join) { if (!is_user_logged_in()) { global $wpdb; return $join . “LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)”; } return $join; } 2) You need to include condition to select a post with … Read more
How to create a completely functioning separate archive for posts from only 1 or 2 specific categories
Archive Meta on Product Post Type
I have created a basic example on how you could achieve this result. // get all posts from our CPT no matter the status $posts = get_posts([ ‘post_type’ => ‘papers’, // based on the post type from your qeustion ‘post_status’ => ‘all’, ‘posts_per_page’ => -1 ]); // will contain all posts count by year // … Read more
Create a CUstom Archive by Year, but just for a Single Category
I haven’t found an easy way but here is a solution: I get the month and year from the current archive and compare them with the text. $year = get_query_var( ‘year’ ); $monthnum = get_query_var( ‘monthnum’ ); $monthname = $GLOBALS[‘wp_locale’]->get_month( $monthnum ); $date = $monthname . ‘ ‘ . $year; if ( $text === $date … Read more
I would suggest taking a look at the Template Hierarchy structure to fully understand WHY archive.php overwrites certain pages (although it shouldn’t overwrite search results) If you wanted to go a custom template direction (might be the best way) I would do something like this create a monthly-arcive.php file and paste the following (you can … Read more