Latest Posts not showing the number specified

Home Forums All Other Themes Latest Posts not showing the number specified

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #58708
    HillorieHillorie
    Member
    • Topics: 5
    • Replies: 9
    • Total: 14
    Member since: July 22, 2016

    Hello,

    Recently Dave helped me display latest posts in 2 columns in this thread successfully https://www.sktthemes.org/forums/topic/display-posts-column/

    However I just noticed that even though I set my latestposts to show 8, it is only showing 3 at www.neverendingworldtour.com in the home page under “Latest Posts”.
    It is currently showing 2 columns which is what I want, but only 3 posts when I put [latestposts show=”8″ cat=”1″]

    #58709
    HillorieHillorie
    Member
    • Topics: 5
    • Replies: 9
    • Total: 14
    Member since: July 22, 2016

    If it helps, this is currently the code in my custom functions

    // [latestposts show=” ” cat=” “]
    function latestpostsoutput_func( $atts ){
    extract( shortcode_atts( array(
    ‘show’ => ”,
    ‘cat’ => ”,
    ), $atts ) );
    $postoutput = ”;
    wp_reset_query();
    $n = 0;
    query_posts( array( ‘posts_per_page’=>$show, ‘cat’=>$cat, ‘post__not_in’ => get_option(‘sticky_posts’) ) );
    if ( have_posts() ) :
    while ( have_posts() ) : the_post();

    $n++;
    if( $n%2==0 ) $nomgn = ‘last’; else $nomgn = ‘ ‘;
    if ( has_post_thumbnail()) {
    $LARGE_imgSrc = wp_get_attachment_image_src( get_post_thumbnail_id(), ‘LARGE’);
    $imgUrl = $LARGE_imgSrc[0];
    }else{
    $imgUrl = get_template_directory_uri().’/images/img_404.png’;
    }
    $postoutput .= ‘<div class=”news-box ‘.$nomgn.'”>
    <div class=”news-thumb”>

    </div>
    <div class=”news”>
    <h6>’.get_the_title().'</h6>
    <div class=”date-news”>
    <span class=”byadmin-home”><i class=”fa fa-user”></i> Posted By ‘ . get_the_author() . ‘ </span>
    <span><i class=”fa fa-calendar”></i> Posted On ‘.get_the_time(‘d-M-Y’).’</span>
    </div>
    <div><p>’.wp_trim_words( get_the_content(), of_get_option(‘blogpostshortcode’), ” ).'</p></div>
    ‘.of_get_option(‘blogpostreadmore’).’
    </div>
    </div>’;
    $postoutput .= ”.(($n%2==0) ? ‘<div class=”clear”></div>’ : ”);

    endwhile;
    endif;
    wp_reset_query();
    return $postoutput;
    }
    add_shortcode( ‘latestposts’, ‘latestpostsoutput_func’ );

    #58768
    Sonl SinhaSonl Sinha
    Moderator
    • Topics: 0
    • Replies: 31029
    • Total: 31029
    Member since: August 16, 2013

    Hi Hillorie,

    Kindly send us your URL of the site and WordPress admin details via sktthemes.net/contact

    Please mention this forum URL while replying so that we understand what needs to be done.

    Regards,
    Brad

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.