forked from caslay/tiny_theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
author.php
68 lines (52 loc) · 1.75 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
get_header();
?>
<?php
//getting current author name
if(isset($_GET['author_name'])) :
$curauth = get_userdatabylogin($author_name);
else :
$curauth = get_userdata(intval($author));
endif;
?>
<div class="container">
<header class="title">
<h2> <?php echo $curauth->nickname ?> Posts</h2>
</header>
<div class="posts">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php if ( is_sticky() ): ?>
<article id='<?php the_ID(); ?>' <?php post_class('sticky'); ?> >
<?php else: ?>
<article id='<?php the_ID(); ?>' <?php post_class(); ?> >
<?php endif; ?>
<h2><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h2>
<?php the_excerpt() ?>
</article>
<?php endwhile; ?>
</div>
<div class="pagination">
<?php
global $wp_query;
$total = $wp_query->max_num_pages;
// only bother with the rest if we have more than 1 page!
if ( $total > 1 ) {
// get the current page
if ( !$current_page = get_query_var('paged') )
$current_page = 1;
// structure of "format" depends on whether we're using pretty permalinks
$format = get_option('permalink_structure')?'page/%#%/':'&page=%#%';
echo paginate_links(array(
'base' => get_pagenum_link(1) . '%_%',
'format' => $format,
'current' => $current_page,
'total' => $total,
'mid_size' => 4,
'type' => 'plain'
));
}
?>
</div>
<?php endif; ?>
</div>
<?php get_footer()?>