• yologroup

    (@yologroup)


    I am working in a template and want to display only the latest article of one category of posts on the home page and display the full post? I am not clear on how to modify this loop. Any suggestions?

    <div class="message_center_left">
    
    <?php
    if ( function_exists( 'get_option_tree' ) ) {
    $featured_number = get_option_tree( 'vn_selectnumberblog' );
    } ?>
    
    <?php
    $featured = new WP_Query('&showposts=' . $featured_number);
    
    while ($featured->have_posts()) : $featured->the_post();
    ?>
    
    <?php get_template_part( 'content', get_post_format() ); ?>
    
    <hr />
    
    <?php endwhile; ?>
    
    <?php wp_reset_query(); ?>
    
    <?php
    if ( function_exists( 'get_option_tree' ) ) {
    $morenewstext = get_option_tree( 'vn_morenewstext' );
    $morenewslink = get_option_tree( 'vn_morenewslink' );
    } ?>
    
    <?php if ($morenewstext != ('')){ ?>
    <a>"><?php echo stripslashes($morenewstext); ?></a>
    <?php } else { } ?>
    
    </div>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    site: ww2.loopthelakeforliteracy.com

  • The topic ‘How to call in only one category of blog posts via the loop’ is closed to new replies.