• I have a custom template page setup as my homepage. I would like to add a loop to display my blog posts on the homepage as well (excerpt posts only).

    I’m familiar with how to display posts, but I’m not sure how to display only “posts” in an area, instead of the page content. How can I insert this loop into the homepage?

Viewing 1 replies (of 1 total)
  • You could create a secondary loop; something like this:

    $args = array(
        'posts_per_page' => get_option( 'posts_per_page' ),
        'paged' =>  get_query_var( 'page' )
    );
    
    $my_query = new WP_Query( $args );
    
    while( $my_query->have_posts() ) { $my_query->the_post();
        /* Your new custom loop */
    }

    I just added arguments that I think are generally useful, but you can use whatever you want. Here’s the codex page for WP_Query():

    Class Reference/WP Query

    To show a post’s excerpt in the loop, you can use the_excerpt():

    Function Reference/the excerpt

Viewing 1 replies (of 1 total)
  • The topic ‘Display Blog Feed on Homepage’ is closed to new replies.