Hi I would like to have a sidebar on a template, I copied a template from the existing templates and made it appear in the templates section, but how do get it to have a side bar? I need to use it for pages not posts
thanks graeme
Hi Graeme,
To have the sidebar, you can add the following code to a page template:
<?php get_sidebar(); ?>
For example, here is the code of Blog page template:
get_header(); ?>
<div class="container-fluid">
<header class="page-header">
<h1 class="page-title"><?php the_title(); ?></h1>
</header>
<div class="row-fluid">
<div id="primary" class="span9">
<div id="content" role="main">
<?php $blog_query = new WP_Query( 'post_type=post&paged='.get_query_var('paged')); ?>
<?php while ( $blog_query->have_posts() ) : $blog_query->the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php $wp_query = $blog_query; ?>
<?php dw_simplex_content_nav( 'nav-below' ); ?>
<?php wp_reset_postdata(); ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div>
</div>
<?php get_footer(); ?>
Hope that helps!
Thanks that worked, but the sidebar (called Main sidebar in the widgets area?) seems to sit in the footer area not to the left side of the page where I expect it be, see http://barguse/2012/showjumping thanks again Graeme
The link you give above does not work so please send it again. Thanks.
Ok this is it
http://barguse.co.uk/2012/showjumping/
But I need it to be a page template not a post template
Hi Graeme !
To create a page template with a sidebar in the DW Simplex, please do as the following:
1. Download the page-sidebar.php file in the link: https://www.dropbox.com/s/cbhhc46a9xlen5i/page-sidebar.php
2. Add the page-sidebar.php file to the “template” folder (\wp-content\themes\dw-simplex\templates)
3. Log in to Dashboard > Pages > Add new, in the Page Attributes pane on the right hand side, select the template as page-sidebar.
See the screenshot:
Hope this helps !
Brilliant thanks, that worked, thanks again – graeme
Please login or Register to submit your answer