-
Notifications
You must be signed in to change notification settings - Fork 0
/
author.php
51 lines (48 loc) · 2.44 KB
/
author.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php get_header(); ?>
<main id="main" class="pure-g blog">
<h1 class="blog-title pd40">Author Archives: <?php the_author_link(); ?><span class="breadcrumb"><?php MyBreadcrumb(); ?></span></h1>
<ul class="recent pure-g">
<?php
// set up or arguments for our custom query
$paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
$query_args = array(
'post_type' => 'post',
'posts_per_page' => 10,
'paged' => $paged
);
// create a new instance of WP_Query
//$the_query = new WP_Query( $query_args );
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); // run the loop ?>
<li>
<?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,’thumbnail’, true); ?>
<h1 class="pd30 the-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<h3 class="pd30 the-subtitle">Posted by <a href="<?php echo get_site_url(); ?><?php echo "/author/"; the_author(); ?>"><?php the_author(); ?></a> on <?php echo get_the_date(); ?> in <a href="<?php $category = get_the_category(); $firstCategory = $category[0]->cat_name; echo $firstCategory;?>"><?php the_category(); ?></a>| <?php comments_popup_link( __( 'Leave a comment', 'themename' ), __( '1 Comment', 'themename' ), __( '% Comments', 'themename' ) ) ?></h3>
<?php if($image_url[0]){ ?>
<figure style='background-image:url(<?php echo $image_url[0]; ?>);'>
<img src="<?php echo $image_url[0]; ?>" width="100%" height="auto" alt="" style="display:none;" />
</figure>
<?php } ?>
<div class="recent-excerpt pd30"><?php the_excerpt(); ?></div>
<a class="recent-link pure-button pure-button-primary" href="<?php echo get_permalink(); ?>">Read More...</a>
</li>
<?php endwhile; ?>
<?php if ('max_num_pages > 1') { // check if the max number of pages is greater than 1 ?>
<nav class="prev-next-posts">
<div class="prev-posts-link">
<?php echo get_next_posts_link( 'Older Entries', 'max_num_pages'); // display older posts link ?>
</div>
<div class="next-posts-link">
<?php echo get_previous_posts_link( 'Newer Entries' ); // display newer posts link ?>
</div>
</nav>
<?php } ?>
<?php else: ?>
<article>
<h1>Sorry...</h1>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
</article>
<?php endif; ?>
</ul>
</main>
<?php get_footer(); ?>