function adjacent_post_link_product($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true)
{
    if ($previous && is_attachment()) {
        $post = get_post(get_post()->post_parent);
    } else {
        $post = get_adjacent_post_product($in_same_cat, $excluded_categories, $previous);
    }
    if (!$post) {
        $output = '';
    } else {
        $title = $post->post_title;
        if (empty($post->post_title)) {
            $title = $previous ? __('Previous Post', 'commercegurus') : __('Next Post', 'commercegurus');
        }
        $title = apply_filters('the_title', $title, $post->ID);
        $feat_image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
        $image = $date = mysql2date(get_option('date_format'), $post->post_date);
        $rel = $previous ? 'prev' : 'next';
        $string = '<div class="prod-dropdown"><a href="' . get_permalink($post) . '" rel="' . $rel . '" class="';
        $inlink = str_replace('%title', $title, $link);
        $inlink = $string . $inlink . '"></a><div class="nav-dropdown"><a href="' . get_permalink($post) . '">' . get_the_post_thumbnail($post->ID, apply_filters('single_product_small_thumbnail_size', 'shop_thumbnail')) . '</a></div></div>';
        $output = str_replace('%link', $inlink, $format);
    }
    $adjacent = $previous ? 'previous' : 'next';
    echo apply_filters("{$adjacent}_post_link", $output, $format, $link, $post);
}
Example #2
0
function adjacent_post_link_product($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true)
{
    if ($previous && is_attachment()) {
        $post = get_post(get_post()->post_parent);
    } else {
        $post = get_adjacent_post_product($in_same_cat, $excluded_categories, $previous);
    }
    if (!$post) {
        $output = '';
    } else {
        $title = $post->post_title;
        if (empty($post->post_title)) {
            $title = $previous ? __('Previous Post', ETHEME_DOMAIN) : __('Next Post', ETHEME_DOMAIN);
        }
        $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) . '" rel="' . $rel . '">';
        $inlink = str_replace('%title', $title, $link);
        $inlink = str_replace('%date', $date, $inlink);
        $inlink = $string . $inlink . '</a>';
        $output = str_replace('%link', $inlink, $format);
    }
    $adjacent = $previous ? 'previous' : 'next';
    echo apply_filters("{$adjacent}_post_link", $output, $format, $link, $post);
}