• Resolved mjpg

    (@mjpg)


    I am calling:

    tbtestimonial('random');

    and expected just one testimonial, but all seem to be output.

    I looked in tb-testimonials.php line 736 and assumed that:

    $q = new WP_Query( array( 'post_type' => 'testimonial', 'post_status' => 'publish', 'orderby' => 'rand', 'showposts' => 1 ) );

    would only output one due to 'showposts' => 1 but I assume my knowledge of WP is not correct.

    (saw this on the WP class reference:

    Display one random post:
    $query = new WP_Query( array ( 'orderby' => 'rand', 'posts_per_page' => '1' ) );

    [‘posts_per_page’ is preferred to ‘showposts’]

    Or is there another way to achieve this with tbtestimonial?

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Travis Ballard

    (@ansimation)

    showposts should still work, i’ll look intot his one fo ryou tonight and get back to you.

    Thread Starter mjpg

    (@mjpg)

    Travis

    Thanks for your reply.

    It is working now. Not sure what changed. The code I am using in my theme index.php is:

    <?php
    // add testimonial - output set from TBTestimonials Output Settings admin page
    tbtestimonial('random');
    ?>

    Seems fine. Sorry to trouble you.

    Martin

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display just one testimonial’ is closed to new replies.