예제 #1
0
        ?>
      </h3>

      <?php 
        if (get_the_author_meta('description')) {
            ?>
      <p><?php 
            esc_html(the_author_meta('description'));
            ?>
</p>
      <?php 
        }
        ?>

      <?php 
        dw_get_author_meta();
        ?>

      <?php 
        if (!is_author()) {
            if (get_the_author_meta('first_name')) {
                $name = esc_html(get_the_author_meta('first_name'));
                // Use the first name if there is one
            } else {
                $name = esc_html(the_author());
                // Fall back to the display name
            }
            ?>
      <p><a class="url go" href="<?php 
            echo get_author_posts_url(get_the_author_meta('ID'));
            ?>
예제 #2
0
파일: functions.php 프로젝트: craigcook/hax
function dw_list_authors()
{
    global $wpdb;
    $users = get_users(array());
    // Do a custom query to get post counts for everyone
    // This will save hundreds of queries over "WordPress-style" code
    $postsByUsersQuery = 'SELECT post_author, COUNT(*) as count, meta_value AS description FROM ' . $wpdb->posts . ' p, ' . $wpdb->usermeta . ' um WHERE post_status="publish" AND um.meta_key = "description" AND um.user_id = p.post_author AND meta_value != "" AND post_type = "post" GROUP BY post_author';
    $postsByUsersResult = $wpdb->get_results($postsByUsersQuery, ARRAY_A);
    $postsByUsersIndex = array();
    foreach ($postsByUsersResult as $result) {
        $postsByUsersIndex[$result['post_author']] = array('count' => $result['count'], 'description' => $result['description']);
    }
    // Sort by number of posts
    foreach ($users as $user) {
        $count = $postsByUsersIndex[$user->ID]['count'];
        if ($count == '') {
            $count = 0;
        }
        $user->total_posts = $count;
        $user->description = $postsByUsersIndex[$user->ID]['description'];
    }
    usort($users, 'sort_objects_by_total_posts');
    $users = array_reverse($users);
    // Prep column output
    $column1 = $column2 = array();
    $which = true;
    // Generate output for authors
    foreach ($users as $index => $user) {
        if ($user->total_posts > 1 && $user->description) {
            $item = '<li class="vcard" id="author-' . $user->user_login . '">';
            $item .= '<h3><a class="url" href="' . get_author_posts_url($user->ID) . '">';
            if (function_exists('get_avatar')) {
                $item .= get_avatar($user->user_email, 48);
            }
            $item .= '<cite class="fn">' . $user->display_name . '</cite> <span class="post-count">' . $user->total_posts . ' post' . ($user->total_posts > 1 ? 's' : '') . '</span></a></h3>';
            $item .= '<p class="desc">' . $user->description . '</p>';
            $item .= dw_get_author_meta($user->ID);
            $item .= '</li>';
            if ($which) {
                array_push($column1, $item);
            } else {
                array_push($column2, $item);
            }
            $which = !$which;
        }
    }
    $return = '<ul class="author-list">' . implode('', $column1) . '</ul>';
    $return .= '<ul class="author-list">' . implode('', $column2) . '</ul>';
    return $return;
}
예제 #3
0
파일: single.php 프로젝트: craigcook/hax
            <?php 
                }
                ?>
          </h3>
          <?php 
                if ($author->description) {
                    ?>
            <p><?php 
                    echo $author->description;
                    ?>
</p>
          <?php 
                }
                ?>
          <?php 
                echo dw_get_author_meta($author->ID);
                ?>
            <p><a class="url" href="<?php 
                echo get_author_posts_url($author->ID);
                ?>
">More articles by <?php 
                echo hacks_author($author->display_name);
                ?>
&hellip;</a></p>
        <?php 
            }
            ?>
      <?php 
        }
        ?>
    </section>