Home › Forums › All Other Themes › Latest Posts not showing the number specified
- This topic has 2 replies, 2 voices, and was last updated 7 years, 11 months ago by Sonl Sinha.
-
AuthorPosts
-
January 16, 2017 at 4:26 am #58708
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″]January 16, 2017 at 4:27 am #58709If 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’ );January 16, 2017 at 7:34 am #58768Hi 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 -
AuthorPosts
- You must be logged in to reply to this topic.