Home › Forums › WordPress Themes – Premium › Circumference › How to add other blog page templates › Reply To: How to add other blog page templates
March 17, 2015 at 6:41 am
#21106
Participant
Hi Open Table,
To make a new page template that shows certain categories pages, You need to follow the below steps;
1) Create a .php file in the themes page templates folder, for example: category_simple.php
2) Copy all the below code and replace the category name with the category that you want in
query_posts(array('category_name' => 'shekhar'));
3) Remember to change the template name as your wish.
3) Save the file and go to pages and choose the page templates.
<?php $blogstyle = get_theme_mod( 'blog_style', 'blogright' );
switch ($blogstyle) {
// Right Column
case "blogright" :
echo '';
// get specific category pages
query_posts(array('category_name' => 'shekhar'));
if ( have_posts() ) : while ( have_posts() ) : the_post();
// get the article layout
get_template_part( 'content', get_post_format() );
endwhile;
// get the pagination
circumference_paging_nav();
else :
// if no posts
get_template_part( 'content', 'none' );
endif;
echo '';
break;
// Left Column
case "blogleft" :
echo '';
echo '';
query_posts(array('category_name' => 'shekhar'));
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile;
circumference_paging_nav();
else :
get_template_part( 'content', 'none' );
endif;
echo '';
break;
// Left and Right Column
case "blogleftright" :
echo '';
echo '';
query_posts(array('category_name' => 'shekhar'));
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile;
circumference_paging_nav();
else :
get_template_part( 'content', 'none' );
endif;
echo '';
break;
// Wide Column
case "blogwide" :
echo '';
query_posts(array('category_name' => 'shekhar'));
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile;
circumference_paging_nav();
else :
get_template_part( 'content', 'none' );
endif;
echo '';
break;
}
?>
<?php
get_footer();
Thanks.