Make WordPress Core

Ticket #24863: authors-page.php

File authors-page.php, 1.4 KB (added by Kuzmanov, 13 years ago)

Contributors page template

Line 
1<?php
2/**
3 * Template Name: Authors Page
4 *
5 * @package WordPress
6 * @subpackage Twenty_Fourteen
7 */
8
9get_header(); ?>
10
11
12<div id="primary" class="content-area">
13 <div id="content" class="site-content full-width" role="main">
14 <header class="entry-header">
15 <h1 class="entry-title"><?php the_title(); ?></h1>
16 </header>
17
18 <div class="entry-content clearfix">
19 <?php
20
21 global $wpdb;
22
23 $query = "SELECT ID, user_nicename from $wpdb->users ORDER BY user_nicename";
24 $author_ids = $wpdb->get_results($query);
25
26 foreach($author_ids as $author) :
27 $post_count = count_user_posts($author->ID);
28 if($post_count>=1) :
29 $curauth = get_userdata($author->ID);
30 if($curauth->user_level > 0 || $curauth->user_login == 'admin') :
31 $user_link = get_author_posts_url($curauth->ID);
32 ?>
33
34 <div class="contributors-box">
35 <div class="contributor-info">
36 <h3>
37 <a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>"><?php echo $curauth->display_name; ?></a>
38 </h3>
39 <p class="contributor-bio"><?php echo $curauth->description; ?></p>
40 <p class="contributor-posts"><a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>">Read Articles</a></p>
41 </div>
42 </div>
43
44 <?php endif; endif; ?>
45 <?php endforeach; ?>
46
47 </div>
48 </div>
49</div>
50
51<?php get_sidebar(); ?>
52<?php get_footer(); ?>