• Hello I need to display posts from a single category (category ID=5) on our theme’s ‘page with blog page template'(page-blog.php). This is the code used for the template:

    <?php
    /**
    * Template Name: Page with Blog
    **/
    ?>
    <?php get_template_part('system','header');?>
    	<!--CONTENT-->
    		<div class="content">
    			<?php if (have_posts()) : ?>
    			<div class="breadcrumbs style-2">
    <p style="text-indent: 5em;">				<?php echo __('&nbsp;You are here:','xceleron');?> <?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>
    				<div class="t-social">
    					<?php if(of_get_option("facebook_link")!=null): ?><a href="<?php echo of_get_option("facebook_link");?>" class="fb"><img src="<?php bloginfo('template_directory');?>/img/fb-small.png" alt=""/><?php echo __('Like','xceleron');?></a><?php endif;?>
    					<?php if(of_get_option("twitter_link")!=null): ?><a href="<?php echo of_get_option("twitter_link");?>"><img src="<?php bloginfo('template_directory');?>/img/twitter-small.png" alt=""/><?php echo __('Follow us','xceleron');?></a><?php endif;?>
    					<a href="<?php get_bloginfo('rss2_url');?>"><img src="<?php bloginfo('template_directory');?>/img/rss-small.png" alt=""/><?php echo __('RSS feed','xceleron');?></a>
    				</div>
    			</div>
    			<?php endif; ?>
    			<div class="hAlign clearfix">
    				<div class="l-content">
    					<?php
    						if (have_posts()) :
    						while (have_posts()) : the_post();
    					?>
    					<?php the_content();?>
    					<?php echo do_shortcode('[blog]'); ?>
    					<?php endwhile;endif; ?>
    				</div>
    				<div class="sidebar">
    					<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("BlOG SIDEBAR") ) : endif; ?>
    				</div>
    			</div>
    
    		</div>
    	</div>
    	<!--END CONTENT-->
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • I think this would work

    <?php get_template_part('system','header');?>
    	<!--CONTENT-->
    		<div class="content">
    			<?php if (have_posts()) : ?>
    			<div class="breadcrumbs style-2">
    <p style="text-indent: 5em;">				<?php echo __('&nbsp;You are here:','xceleron');?> <?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>
    				<div class="t-social">
    					<?php if(of_get_option("facebook_link")!=null): ?><a href="<?php echo of_get_option("facebook_link");?>" class="fb"><img src="<?php bloginfo('template_directory');?>/img/fb-small.png" alt=""/><?php echo __('Like','xceleron');?></a><?php endif;?>
    					<?php if(of_get_option("twitter_link")!=null): ?><a href="<?php echo of_get_option("twitter_link");?>"><img src="<?php bloginfo('template_directory');?>/img/twitter-small.png" alt=""/><?php echo __('Follow us','xceleron');?></a><?php endif;?>
    					<a href="<?php get_bloginfo('rss2_url');?>"><img src="<?php bloginfo('template_directory');?>/img/rss-small.png" alt=""/><?php echo __('RSS feed','xceleron');?></a>
    				</div>
    			</div>
    			<?php endif; ?>
    			<div class="hAlign clearfix">
    				<div class="l-content">
    					<?php
    						if (have_posts()) :
    						query_posts('cat=5'); while (have_posts()) : the_post();
    					?>
    					<?php the_content();?>
    					<?php echo do_shortcode('[blog]'); ?>
    					<?php endwhile;endif; ?>
    				</div>
    				<div class="sidebar">
    					<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("BlOG SIDEBAR") ) : endif; ?>
    				</div>
    			</div>
    
    		</div>
    	</div>
    	<!--END CONTENT-->
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Display posts from single category on blog page template’ is closed to new replies.