Title: Specify layout in template
Last modified: October 4, 2016

---

# Specify layout in template

 *  [FadingMusic](https://wordpress.org/support/users/fadingmusic/)
 * (@fadingmusic)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/specify-layout-in-template/)
 * Hello,
 * I need to specify page layout in a template file.
    How do I do this?
 * Thank you in advance!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [bdbrown](https://wordpress.org/support/users/bdbrown/)
 * (@bdbrown)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/specify-layout-in-template/#post-8252545)
 * Hi fadingmusic. If your template file includes the get_sidebar() function then
   the layout you select on the page editor should be applied to that specific page.
   If you want to apply a default layout to every page that uses the template you
   could copy the hu_layout_class() function in /functions/init-front.php to your
   child theme functions.php file, then modify it to look for your template file
   and apply one of the layouts specified in Customize > Content > Layout Options.
   Here are a couple of references:
    [http://stackoverflow.com/questions/23889568/find-out-whether-a-template-file-is-used-by-a-page-and-get-that-page-wordpress](http://stackoverflow.com/questions/23889568/find-out-whether-a-template-file-is-used-by-a-page-and-get-that-page-wordpress)
   [https://developer.wordpress.org/reference/functions/is_page_template/](https://developer.wordpress.org/reference/functions/is_page_template/)
 *  Thread Starter [FadingMusic](https://wordpress.org/support/users/fadingmusic/)
 * (@fadingmusic)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/specify-layout-in-template/#post-8252598)
 * Hello bdbrown, and thank you kindly for your reply.
 * I’m using BBpress and it’s slug /forums, doesn’t allow me to edit the page and
   thus changing the layout for that page. To fix this, I created a dynamic sidebar
   and changed the template sidebar to:
 * `<?php get_sidebar('forum'); ?>`
 * I copied sidebar-2.php to sidebar-forum.php, which looks like this:
 *     ```
       <div class="sidebar s2">
   
       	<a class="sidebar-toggle" title="<?php _e('Expand Sidebar','hueman'); ?>"><i class="fa icon-sidebar-toggle"></i></a>
   
       	<div class="sidebar-content">
   
       		<?php if ( hu_is_checked('sidebar-top') ): ?>
         		<div class="sidebar-top group">
         			<p><?php _e('More','hueman'); ?></p>
         		</div>
       		<?php endif; ?>
   
       <?php dynamic_sidebar( 'forum' ); ?>
   
       	</div><!--/.sidebar-content-->
   
       </div><!--/.sidebar-->
       ```
   
 * I can add widgets to my dynamic sidebar and it will output on the right, but 
   while the s1 sidebar is not even present, it somehow still takes up the empty
   space.
 * I hope I don’t confuse you.
 *  [bdbrown](https://wordpress.org/support/users/bdbrown/)
 * (@bdbrown)
 * [9 years, 7 months ago](https://wordpress.org/support/topic/specify-layout-in-template/#post-8252634)
 * That’s probably because the theme sets the layout using the hu_layout_class()
   function in sidebar.php. Since the default theme layout is sidebar-content-sidebar,
   and it’s not being changed by hu_layout_class, it’s probably displaying the page
   with that layout even though the primary sidebar isn’t present.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Specify layout in template’ is closed to new replies.

 * ![](https://i0.wp.com/themes.svn.wordpress.org/hueman/3.7.27/screenshot.png)
 * Hueman
 * [Support Threads](https://wordpress.org/support/theme/hueman/)
 * [Active Topics](https://wordpress.org/support/theme/hueman/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/hueman/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/hueman/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [bdbrown](https://wordpress.org/support/users/bdbrown/)
 * Last activity: [9 years, 7 months ago](https://wordpress.org/support/topic/specify-layout-in-template/#post-8252634)
 * Status: not resolved