Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i am wondering how i go about making a Template for some of my pages to use a different sidebar? I have created the widget like this:

register_sidebar(array(
    'id' => 'ourPat-sidebar',
    'name' => 'ourPat Sidebar',
    'before_widget' => '<div class="widget %2$s" id="%1$s">',
    'after_widget' => '</div>',
    'before_title' => '<h3>',
    'after_title' => '</h3>'
));

In side my Functions.php code.

Then i go into my Widget panel and its displayed just fine. Then i proceed to add text to it in order to form the sidebar html.

widget menu

However, when i go to my Page menu and create a new page, i do not have the choice to use the custom widget code?

theme

So i must be doing something incorrect since its not in there.

To recap, i'm just looking for a way for different pages of mine to use a different sidebar using a custom widget i made.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

In order to accomplish this you will need to also create a separate page template to use. You may need to double check your template head information.

Example:

<?php 
 /*
  * Template Name: Your Template name
 */
?>

This has to be put at the top of the page template. Then within the custom page template you will need to call the custom sidebar that you have.

You will need to put this in the template where you want your sidebar to go:

<?php 
if ! dynamic_sidebar( 'ourPat Sidebar' ) ) :
    ?>
    You need to add widgets for items to show in this area. To add for this area add widgets to "ourPat Sidebar".
    <?php 
endif; 
?>
share|improve this answer
    
Awesome! Thanks for the help there, Nicole! –  StealthRT Nov 27 '12 at 20:33
    
No problem. Glad to have been able to help. :) –  Nicole Nov 27 '12 at 21:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.