Robin Cox
Robin Cox

Reputation: 1490

How to create the blogpage in Wordpress

I have a different looking startpage that loads if is_home(). How can I create the blogpage for listing of all my posts, is it a page or even a new post???

Upvotes: 0

Views: 185

Answers (2)

ebohlman
ebohlman

Reputation: 15003

The ability to do what you want is built-in. Just create an empty page end give it the title you want for your "all posts" display. Then go into Settings > Reading and set the appropriate option for "Front page displays" and choose that blank page as you "Posts page".

By default, that page will now display all your posts. is_home() will be true whenever that page is being displayed, but is_front_page() will be false since it won't be your front page. If you have a home.php in your theme, that will be used as the template for your posts page, so if you don't like the default look, just put a modified version of index.php there.

Upvotes: 0

Abhimanue Tamang
Abhimanue Tamang

Reputation: 580

you have to do two things

  1. create a custom template.
  2. create a new page.

step 1 create a new template and write this code

<?php
$args = array( 'post_type' => 'post','post_status' => 'published' );
$query = new WP_Query( $args );
while( $query->have_posts() ):
    $query->next_post();
    echo '<li>' . get_the_title( $query->post->ID ) . '</li>';
endwhile;

wp_reset_postdata();

?>

step 2. in step 2 create a new page and assign custom made template in step 1 as a template from admin panel.

Upvotes: 2

Related Questions