Exemplo n.º 1
0
function be_adjacent_post_link($format, $link = '%title', $in_same_cat = false, $excluded_categories = '', $previous = true, $taxonomy = 'category')
{
    if ($previous && is_attachment()) {
        $post =& get_post($GLOBALS['post']->post_parent);
    } else {
        $post = be_get_adjacent_post($in_same_cat, $excluded_categories, $previous, $taxonomy);
    }
    if (!$post) {
        return;
    }
    $title = $post->post_title;
    if (empty($post->post_title)) {
        $title = $previous ? __('Previous Post', THB_THEME_NAME) : __('Next Post', THB_THEME_NAME);
    }
    $title = thb_ShortenText(get_the_title($post->ID), 35);
    $image_id = get_post_thumbnail_id($post->ID);
    $image_link = wp_get_attachment_image_src($image_id, 'full');
    $image = aq_resize($image_link[0], 100, 100, true, false);
    $image_title = esc_attr(get_the_title($post->ID));
    $image = '<img src="' . $image[0] . '" width="' . $image[1] . '" height="' . $image[2] . '" title="' . $image_title . '" />';
    $date = mysql2date(get_option('date_format'), $post->post_date);
    $rel = $previous ? 'prev' : 'next';
    $string = '<a href="' . get_permalink($post) . '" rel="' . $rel . '" data-id="' . $post->ID . '" class="' . $rel . '">';
    $link = str_replace('%title', $title, $link);
    $link = str_replace('%image', $image, $link);
    $link = $string . $link . '</a>';
    $format = str_replace('%link', $link, $format);
    $adjacent = $previous ? 'previous' : 'next';
    echo apply_filters("{$adjacent}_post_link", $format, $link);
}
Exemplo n.º 2
0
function thb_post_navigation($arg)
{
    ?>
	<div class="portfolio_nav row no-padding">
		<div class="small-12 medium-4 columns">
			<?php 
    be_previous_post_link(false, '', $arg[0]);
    ?>
		</div>
		<div class="small-12 medium-4<?php 
    if (!be_get_adjacent_post(false, '', $arg[0])) {
        ?>
 medium-push-4<?php 
    }
    ?>
 columns">
			<a href="<?php 
    echo $arg[1];
    ?>
" class="gotoportfolio"><?php 
    echo $arg[2];
    ?>
</a>
		</div>
		<div class="small-12 medium-4 columns">
			<?php 
    be_next_post_link(false, '', $arg[0]);
    ?>
		</div>
	</div>
<?php 
}
Exemplo n.º 3
0
function be_adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true, $taxonomy = 'category')
{
    if ($previous && is_attachment()) {
        $post =& get_post($GLOBALS['post']->post_parent);
    } else {
        $post = be_get_adjacent_post($in_same_cat, $excluded_categories, $previous, $taxonomy);
    }
    if (!$post) {
        return;
    }
    $title = $post->post_title;
    if (empty($post->post_title)) {
        $title = $previous ? __('Previous Post', AZ_THEME_NAME) : __('Next Post', AZ_THEME_NAME);
    }
    $title = apply_filters('the_title', $title, $post->ID);
    $date = mysql2date(get_option('date_format'), $post->post_date);
    $rel = $previous ? 'prev' : 'next';
    $string = '<a href="' . get_permalink($post) . '" title="' . $title . '">';
    $link = str_replace('%title', $title, $link);
    $link = str_replace('%date', $date, $link);
    $link = $string . $link . '</a>';
    $format = str_replace('%link', $link, $format);
    $adjacent = $previous ? 'previous' : 'next';
    echo apply_filters("{$adjacent}_post_link", $format, $link);
}
Exemplo n.º 4
0
		/**
		 * Retrieve next post that is adjacent to current post.
		 *
		 * @since 1.5.0
		 *
		 * @param bool $in_same_cat Optional. Whether post should be in same category.
		 * @param array|string $excluded_categories Optional. Array or comma-separated list of excluded category IDs.
		 * @param string $taxonomy Optional. Which taxonomy to use.
		 * @return mixed Post object if successful. Null if global $post is not set. Empty string if no corresponding post exists.
		 */
		function be_get_next_post($in_same_cat = false, $excluded_categories = '', $taxonomy = 'category') {
			return be_get_adjacent_post($in_same_cat, $excluded_categories, false, $taxonomy);
		}