• Resolved Syrehn

    (@syrehn)


    So what I’m trying to do is include custom dynamic sidebars for specific pages using only the sidebar.php file

    Currently I have a page called “page-coupon.php” and I’m calling my sidebar as follows:

    <?php if(is_page()) {
    //We're on a "page", which?
    if (is_page('279')) {
    // Ah, the Coupons page!
    get_sidebar();
    } else {
    // If we're not on the coupon pages
    if(!get_post_meta($post->ID, "noSidebar", true)) {
    get_sidebar();
    }
    }
    };
    ?>

    in my functions.php i have the following to activate my widgets:

    //Activate Your Widgetized Areas
    if ( function_exists('register_sidebar' ) ) {
    $allWidgetizedAreas = array("Sidebar", "couponSidebar", "Footer1", "Footer2", "Footer3");
    foreach ($allWidgetizedAreas as $WidgetAreaName) {
    register_sidebar(array(
    'name'=> $WidgetAreaName,
    'before_widget' => '<div id="%1$s" class="widget %2$s left half">',
    'after_widget' => '</div>',
    'before_title' => '<h3 class="widgettitle">',
    'after_title' => '</h3>',
    ));
    }
    }

    and I’m trying to figure out the best way to add this to my sidebar.php file. to start with I have:

    <ul>
    <?php if (is_page('279')) {
    if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('couponSidebar') ) : ?>
    <?php } endif; ?>
    
    <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar() ) ?>

    I don’t think the above is correct and I’m not 100% sure how to go about getting it to work. Currently my widget areas generate and I can place stuff into them but all the sidebars appear blank. I’ve reviewed lots of articles on custom sidebars but haven’t been able to find an answer. Can anyone offer up any assistance?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom Dynamic Sidebars?’ is closed to new replies.