Graeme Blakeburn
asked 10 years ago

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

2 Answers
Kido D
answered 10 years ago

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>
<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(); ?>
<?php get_footer(); ?>

Hope that helps!

Graeme Blakeburn
replied 10 years ago

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

Kido D
replied 10 years ago

The link you give above does not work so please send it again. Thanks.

Graeme Blakeburn
replied 10 years ago

Ok this is it
But I need it to be a page template not a post template

answered 10 years ago

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:
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 !

Graeme Blakeburn
replied 10 years ago

Brilliant thanks, that worked, thanks again – graeme

Powered by DW Question & Answer Pro