Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to output a custom post type archive using a shortcode. Everything works fine except for the get_next_posts_link part. The weird part is that it's right next to a get_previous_posts_link that works perfectly.

Here's the function

function output_tips() {
global $paged;
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array( 'post_type' => 'ht_tips', 'posts_per_page' => 1, 'paged' => $paged, 'caller_get_posts' => 1, 'orderby' => 'date', 'order' => 'DESC' );
$loop = new WP_Query( $args );

$inner = '';

while ( $loop->have_posts() ): $loop->the_post(); global $post;

    $title = '<h3>'. get_the_title() .'</h3>';

    $content = get_the_content();

    $output = '<div class="testimonial">' . $title . $content . '</div>';

    $inner .= $output;

endwhile; 

$prev = '<div class="nav-previous">' . get_previous_posts_link( __( '<span class="meta-nav">&larr;</span> Previous' ) ) . '</div>';
$next = '<div class="nav-next">' . get_next_posts_link( __( 'Next <span class="meta-nav">&rarr;</span>' ) ) . '</div>';

wp_reset_postdata();

$open = '<div class="testimonials">';
$close = '</div>';
$return = $open . $inner . $prev . $next . $close;

return $return;
}

Any idea why this might be?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.