Created
August 5, 2019 08:42
-
-
Save celticwebdesign/579c22b19e692030beae5ee36f934dbe to your computer and use it in GitHub Desktop.
Revisions
-
celticwebdesign renamed this gist
Aug 5, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
celticwebdesign created this gist
Aug 5, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,66 @@ <?php // https://wordpress.stackexchange.com/a/152012 // How to show monthly archive posts? // this can be used for many other archive pages, see the link above. if (is_category()) { /* If this is a category archive */ $cat = get_query_var('cat'); $category = get_category($cat); $taxonomy = 'category="'.$category->slug.'"'; } elseif( is_tag() ) { /* If this is a tag archive */ $tag = get_query_var('tag'); $taxonomy = 'tag="'.$tag.'"'; } elseif( is_month() || is_year() ) { /* If this is a monthly archive */ $year = get_the_date('Y'); $month = get_the_date('m'); } ?> <div class="wrapper" id="archive-wrapper"> <main class="site-main" id="main"> <section id="news__alm_news"> <div class="container"> <div class="page-title"> <?php the_archive_title( '<h1 class="page-title">', '</h1>' ); ?> </div> <?php if (is_category() || is_tag()) { echo do_shortcode('[ajax_load_more post_type="post" posts_per_page="6" '.$taxonomy.' scroll="false" transition_container_classes="row" images_loaded="true"]'); } elseif( is_year() ) { echo do_shortcode('[ajax_load_more post_type="post" posts_per_page="6" year="' . $year . '" scroll="false" transition_container_classes="row" images_loaded="true"]'); } elseif( is_month() ) { echo do_shortcode('[ajax_load_more post_type="post" posts_per_page="6" year="' . $year . '" month="' . $month . '" scroll="false" transition_container_classes="row" images_loaded="true"]'); } ?> </div> </section> </main><!-- #main --> </div>