1

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.

1

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; 
?>
  • No problem. Glad to have been able to help. :) – Nicole Nov 27 '12 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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