// Support for the Yet Another Related Posts Plugin if (function_exists('yarpp_get_related')) { $related = yarpp_get_related(array('limit' => $posts_per_page), $post->ID); return new WP_Query(array('post__in' => wp_list_pluck($related, 'ID'), 'posts_per_page' => $posts_per_page, 'orderby' => 'rand', 'ignore_sticky_posts' => true, 'post__not_in' => array($post->ID))); } $args = array('post_type' => 'jetpack-portfolio', 'posts_per_page' => $posts_per_page, 'orderby' => 'rand', 'ignore_sticky_posts' => true, 'post__not_in' => array($post->ID)); // Get posts from the same category. $categories = get_the_category(); if (!empty($categories)) { $category = array_shift($categories); $args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $category->term_id)); } return new WP_Query($args); } } allurer::setup(); // Lets do a separate excerpt length for our home blog feed function allurer_homefeed_excerpt() { $theContent = trim(strip_tags(get_the_content())); $output = str_replace('"', '', $theContent); $output = str_replace('\\r\\n', ' ', $output); $output = str_replace('\\n', ' ', $output); if (get_theme_mod('allurer_homefeed_excerpt_length')) { $limit = get_theme_mod('allurer_homefeed_excerpt_length'); } else { $limit = '10'; } $content = explode(' ', $output, $limit); array_pop($content); $content = implode(" ", $content) . " ";
<?php /** */ do_action('allurer_related_posts_before'); $allurer_related_posts = allurer::get_related_posts(); if ($allurer_related_posts->have_posts() && $allurer_related_posts->found_posts >= 2) { ?> <div class="related-content"> <h3 class="related-content-title"><?php _e('You may also find these articles interesting', 'allurer'); ?> </h3> <?php while ($allurer_related_posts->have_posts()) { $allurer_related_posts->the_post(); ?> <article id="post-<?php the_ID(); ?> " class="hentry"> <header class="entry-header"> <a class="post-thumbnail" href="<?php the_permalink(); ?> "><span><?php the_post_thumbnail(); ?>
<?php /** */ do_action('allurer_related_projects_before'); $allurer_related_projects = allurer::get_related_projects(); if ($allurer_related_projects->have_posts() && $allurer_related_projects->found_posts >= 2) { ?> <div class="related-content"> <h3 class="related-content-title"><?php _e('Our other projects', 'allurer'); ?> </h3> <?php while ($allurer_related_projects->have_posts()) { $allurer_related_projects->the_post(); ?> <article id="post-<?php the_ID(); ?> " class="hentry"> <header class="entry-header"> <a class="post-thumbnail" href="<?php the_permalink(); ?> " title="Project: <?php the_title(); ?>