示例#1
0
function get_primary_category($post, $without = array('featured', 'hp_lead', 'sponsored'))
{
    $primary_category_data = simple_fields_value('primary_category', $post);
    if ($primary_category_data && $primary_category_data['selected_value']) {
        $primary_category = get_term_by('name', $primary_category_data['selected_value'], 'category');
    } else {
        $primary_category = get_post_categories($post, $without, 1);
    }
    return $primary_category;
}
?>
 -->
            </ul>
            <a href="#" data-modal data-modal-content="authors">See all Authors &gt;</a>
        </div>
        <div class="medium-8 columns left">
            <p class="lead"><?php 
the_author_meta('description', $author_id);
?>
</p>

            <ul class="recent-articles">
                <?php 
while ($author_posts->have_posts()) {
    $author_posts->the_post();
    $categories = get_post_categories();
    ?>
                    <li class="recent-articles-item <?php 
    echo has_post_thumbnail() ? 'has-thumbnail' : '';
    ?>
">
                        <?php 
    the_post_thumbnail(array(80, 80), array('class' => 'thumbnail'));
    ?>
                        <a href="<?php 
    the_permalink();
    ?>
"><h3><?php 
    echo one_of(simple_fields_fieldgroup('short_title'), get_the_title());
    ?>
</h3></a>
    ?>
		                </div>
		                <a href="<?php 
    the_permalink();
    ?>
"><h3><?php 
    echo one_of(simple_fields_fieldgroup('short_title'), get_the_title());
    ?>
</h3></a>
		                <p><?php 
    the_excerpt();
    ?>
</p>
		                <p>
		                    <?php 
    $categories = get_post_categories($post, array('featured', 'sponsored'));
    foreach ($categories as $category) {
        ?>
		                        <a href="<?php 
        echo get_category_link($category->term_id);
        ?>
" class="topics-tag-minimal <?php 
        echo $category->slug;
        ?>
"><?php 
        echo $category->name;
        ?>
</a>
		                    <?php 
    }
    ?>
    ?>
"><img src="<?php 
    theme_image_src('icons/social-google-plus-grey.svg');
    ?>
"></a></li>
		<?php 
}
?>
	</ul>

<!-- 	<?php 
$author_posts = new WP_Query(array('author' => $author_id, 'posts_per_page' => -1));
$categories = array();
while ($author_posts->have_posts()) {
    $author_posts->the_post();
    $post_categories = get_post_categories($post);
    foreach ($post_categories as $post_category) {
        $categories[$post_category->slug] = $post_category;
    }
}
foreach ($categories as $category) {
    ?>
    	<a href="/search?cat=<?php 
    echo $category->slug;
    ?>
&author=<?php 
    the_author_meta('user_nicename', $author_id);
    ?>
" class="topics-tag-minimal <?php 
    echo $category->slug;
    ?>