Reputation: 13
i want to create a separate blog page design so how can i proceed this.
Also ,i have set the static front page home -> home page and post page->blog now i want to assign different design for blog page
Upvotes: 0
Views: 411
Reputation: 408
Custom template will start as follows:
<?php
/* Template Name: Blog */
get_header(); ?>
Wordpress loop to call posts:
<?php query_posts('posts_per_page=-1');
if (have_posts()) : while (have_posts()) : the_post(); ?>
<h1 class="title"><?php the_title(); ?></h1>
<div class="post" id="post-<?php the_ID(); ?>">
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
</div>
</div>
<?php endwhile; endif; wp_reset_query();?>
As you have created new template you can add your own class and ids and style according to your new design.
Upvotes: 1
Reputation: 21
Wordpress have some conditional tags that you can easily handle your template file based on different page, use this conditions, i hope it'll help you
if ( is_front_page() && is_home() ) { //for home page
//homepage template
get_template_part($slug);
} elseif ( is_front_page() ) { //Static home page
//static homepage template
get_template_part($slug);
} elseif ( is_home() ) { //blog page template
// blog page template
get_template_part($slug);
} else {
//other template
get_template_part($slug);
}
Upvotes: 1
Reputation: 501
You can make Home template:
/*
Template Name: Home
*/
<?php
// here is Home page markup
And at index.php you can set blog design. Like a
<?php
if (have_posts()): ?>
<?php while(have_posts()) : the_post(); ?>
<article>
<?php
the_title();
the_content();
?>
</article>
<?php endwhile; ?>
<?php endif ?>
Upvotes: 1
Reputation: 1
I am not familiar with Wordpress, but a quick look resulted in the following page. There is a tutorial on how to create extra blog pages in Wordpress.
http://www.wpbeginner.com/wp-tutorials/how-to-create-a-separate-page-for-blog-posts-in-wordpress/
Hope this helps!
Dirk
Upvotes: 0