Esempio n. 1
0
<?php

/**
 */
do_action('unconditional_related_posts_before');
$unconditional_rel_posts = Unconditional::get_related_posts();
if ($unconditional_rel_posts->have_posts() && $unconditional_rel_posts->found_posts >= 2) {
    ?>

<div class="related-content">
	<h3 class="related-content-title"><?php 
    _e('You may also find these articles interesting', 'unconditional');
    ?>
</h3>

	<?php 
    while ($unconditional_rel_posts->have_posts()) {
        $unconditional_rel_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();
        ?>
Esempio n. 2
0
        // 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);
    }
}
Unconditional::setup();
// Lets do a separate excerpt length for our home blog feed
function unconditional_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('unconditional_homefeed_excerpt_length')) {
        $limit = get_theme_mod('unconditional_homefeed_excerpt_length');
    } else {
        $limit = '55';
    }
    $content = explode(' ', $output, $limit);
    array_pop($content);
    $content = implode(" ", $content) . "  ";
Esempio n. 3
0
<?php

/**
 */
do_action('unconditional_related_projects_before');
$unconditional_rel_proj = Unconditional::get_related_projects();
if ($unconditional_rel_proj->have_posts() && $unconditional_rel_proj->found_posts >= 2) {
    ?>

<div class="related-content">
	<h3 class="related-content-title"><?php 
    _e('Our other projects', 'unconditional');
    ?>
</h3>

	<?php 
    while ($unconditional_rel_proj->have_posts()) {
        $unconditional_rel_proj->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();
        ?>