Show Post of a single Category per Blogpage
-
Hi everybody,
I am not an expert on wordpress. I will describe what I would like to do and maybe someone can tell me it is possible or not and if it is how I can do it.
I would like to show Post from a single category on my blog. To do this I would like the modify the template for the blog. Then I would like to copy that template, change the name and the category so that i can select different templates for pages.
Here is the code for the template:
<?php /* Template Name: Blog */ get_header(); $catid = get_query_var('cat'); $cat = &get_category($catid); $custom = get_post_custom($post->ID); $layout = isset ($custom['_page_layout']) ? $custom['_page_layout'][0] : '1'; $promo = get_post_meta($post->ID, "_promo", $single = false); $slider = get_post_meta($post->ID, "_chosen_slider", $single = false); $al_options = get_option('al_general_settings'); $breadcrumbs = $al_options['al_show_breadcrumbs']; $titles = $al_options['al_show_page_titles']; ?> <div class="container region3wrap"> <?php if(!empty($slider[0]) ):?> <div class="mainslider-container responsive"> <?php putRevSlider($slider[0]); ?> </div> <?php endif?> <?php if(!empty($promo[0]) ):?> <div class="row content_top promo-block"> <div class="twelve columns"> <h2><?php echo do_shortcode($promo[0]);?></h2> </div> </div> <?php endif ?> <?php if($breadcrumbs):?> <div class="row content_top"> <div class="nine columns"> <?php if(class_exists('the_breadcrumb')){ $albc = new the_breadcrumb; } ?> </div> <div class="three columns"> <div class="row"> <div class="twelve columns"> <?php get_search_form(); ?> </div> </div> </div> </div> <?php endif ?> </div> <div class="container region4wrap"> <div class="row maincontent"> <?php if ($titles == 1):?> <div class="twelve columns"> <div class="page_title"> <div class="row"> <div class="twelve columns"> <h1> <?php $headline = get_post_meta($post->ID, "_headline", $single = false); if(!empty($headline[0]) ){echo $headline[0];} else{echo get_the_title();} ?> </h1> </div> </div> </div> </div> <?php endif?> <?php if ($layout == '3'):?> <div class="four columns sidebar-left"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Blog Sidebar") ) : ?> <?php endif;?></div> <?php endif?> <div class="<?php echo $layout == '1' ? 'twelve' : 'eight'?> columns"> <?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $pp = get_option('posts_per_page'); $wp_query->query('posts_per_page='.$pp.'&paged='.$paged); get_template_part( 'loop', 'index' ); ?> </div> <?php if ($layout == '2'):?> <div class="four columns sidebar-right"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Blog Sidebar") ) : ?> <?php endif;?></div> <?php endif?> <div class="clear"></div> </div> </div> <?php get_footer();?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Show Post of a single Category per Blogpage’ is closed to new replies.