?> <article id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <?php if (is_front_page() && is_sticky() && !is_paged()) { ?> <?php if (argo_post_has_features()) { $feature = argo_get_the_main_feature(); $feature_posts = argo_get_recent_posts_for_term($feature, 3, 1); if ($feature_posts) { ?> <div class="sticky-related clearfix"> <dl> <dt>More from <?php echo $feature->name; ?> :</dt> <?php foreach ($feature_posts as $feature_post) { ?> <dd><a href="<?php echo esc_url(get_permalink($feature_post->ID)); ?> "><?php
/** * Provides topics (categories and tags) related to the current post in The * Loop. * * @param int $max The maximum number of topics to return. * @return array of term objects. */ function argo_get_post_related_topics($max = 5) { $cats = get_the_category(); $tags = get_the_tags(); $topics = array(); if ($cats) { foreach ($cats as $cat) { if ($cat->name == 'Uncategorized') { continue; } $posts = argo_get_recent_posts_for_term($cat, 3, 2); if ($posts) { $topics[] = $cat; } } } if ($tags) { foreach ($tags as $tag) { $posts = argo_get_recent_posts_for_term($tag, 3, 2); if ($posts) { $topics[] = $tag; } } } return array_slice($topics, 0, $max); }
?> </a></li> <?php } ?> </ul> <div class="items"> <?php foreach ($rel_topics as $count => $topic) { ?> <div id="rp<?php echo $count; ?> "> <?php $rel_posts = argo_get_recent_posts_for_term($topic, 3); ?> <ul> <?php $top_post = array_shift($rel_posts); ?> <li class="top-related clearfix"> <h3><a href="<?php echo get_permalink($top_post->ID); ?> " title="<?php echo esc_attr($topic->name); ?> "><?php echo $top_post->post_title; ?>