Last active
January 13, 2018 04:37
-
-
Save harshclimate/bcf99d6098e17028851e9f994d41bb67 to your computer and use it in GitHub Desktop.
This is a WP_Query + original loop with post thumbnail archive.
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 characters
<?php get_header(); ?> | |
<article> | |
<div class="left"> | |
<h3>Categories used on the website</h3> | |
<div class="cat-listing"> | |
<span class="category-name">Category name</span><span class="times-used">Times used</span> | |
<p> | |
<?php | |
$args = array( | |
'show_count' => true, | |
'use_desc_for_title' => false, | |
'title_li' => '', | |
'hide_empty' => 0, | |
'style' => '', | |
'separator' => '', | |
); | |
wp_list_categories($args); | |
?> | |
</p> | |
</div> | |
<?php | |
$current_year = the_date('Y'); | |
$post_title_arguments = array( | |
'post_type' => 'post', | |
'post_status' => 'publish', | |
'posts_per_page' => -1, | |
'orderby' => 'ASC', | |
'date_query' => array('year' => $current_year) | |
); $post_title_query = new WP_Query($post_title_arguments); ?> | |
<h3>This years posts by title</h3> | |
<span class="category-name">Entry title</span><span class="times-used">Comments</span> | |
<?php if($post_title_query->have_posts()) { while($post_title_query->have_posts()) { $post_title_query->the_post(); ?> | |
<p class="post-title"><a href="<?php the_permalink(); ?>"><?php echo wp_trim_words(get_the_title(), 8, '...'); ?></a><span><?php echo $post->comment_count; ?></span></p> | |
<?php } ?> | |
<?php } wp_reset_postdata(); ?> | |
</div><!-- /left --> | |
<div class="right"> | |
<div class="thumbnail-archive"> | |
<h2><?php single_cat_title(); ?></h2> | |
<?php if(have_posts()) : while(have_posts()) : the_post(); ?> | |
<p style="background-image: url('<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); ?>');"><a href="<?php the_permalink(); ?>"> </a></p> | |
<?php endwhile; else : echo '<h2>No content found</h2>'; ?> | |
</div> | |
</div><!-- /right --> | |
</article> | |
<?php endif; get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can see it live here: http://www.harshclimate.com/archives/