forked from EarthJournalismNetwork/JEO-Newsroom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
author-template.php
executable file
·82 lines (68 loc) · 2.17 KB
/
author-template.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
/*
Template Name: Author List
*/
?>
<?php get_header(); ?>
<?php if(have_posts()) : the_post(); ?>
<article id="primary" class="content-area" role="main">
<header class="page-header">
<h1><?php the_title(); ?></h1>
</header>
<section class="page-content">
<?php the_content(); ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'jeo' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
) );
?>
<div class="author-alphabet">
<?php
$letter = '';
$newletter = '1';
$blogusers = get_users( 'orderby=nicename' );
usort($blogusers, create_function('$a, $b', 'return strnatcasecmp($a->last_name, $b->last_name);'));
foreach ( $blogusers as $user ) {
if(!$user->last_name == "") {
$letter = substr($user->last_name,0,1);
$letter = strtoupper($letter);
if($letter !== $newletter) {
$newletter = $letter;
echo '<a href="#al-' . $letter . '">' . $letter . '</a>';
}
}
}?>
</div>
<div class="authorsList">
<?php
$letter = '';
$newletter = '1';
$blogusers = get_users( 'orderby=nicename' );
usort($blogusers, create_function('$a, $b', 'return strnatcasecmp($a->last_name, $b->last_name);'));
foreach ( $blogusers as $user ) {
if(!$user->last_name == "") {
$letter = substr($user->last_name,0,1);
$letter = strtoupper($letter);
if($letter !== $newletter) {
$newletter = $letter;
echo '<div class="alphabetListing" id="al-' . $letter . '">' . $letter . '</div>';
}
echo $user->user_url;
echo '<div class="authorListing"><a href="' . get_bloginfo('url') . '/author/' . $user->user_nicename . '">';
echo '' . esc_html( $user->last_name ) . ', ' . esc_html( $user->first_name ) . '';
echo '</a></div>';
}
} ?>
</div>
</section>
<aside id="page-sidebar">
<ul class="widgets">
<?php dynamic_sidebar('general'); ?>
</ul>
</aside>
</article>
<?php endif; ?>
<?php get_footer(); ?>