WordPress.org

Ready to get started?Download WordPress

Forums

custom template with unique sidebar menu (4 posts)

  1. fitzio
    Member
    Posted 2 years ago #

    Working site:
    http://www.fitzio.com/subsite/depaul

    I am trying to create a series of templates. Each displays a unique menu. I am not able to execute the first template successfully. It seems everthing is working except that the page using the template displays the default sidebar rather than the unique "about" nav.
    I followed this tutorial:
    http://codex.wordpress.org/Customizing_Your_Sidebar
    I am creating these templates in a child theme of twentyten, named dePaulSchool.

    I added the following code to my dePaulSchool/functions.php

    <?php if ( function_exists ('register_sidebar')) {
        register_sidebar ('about');
    } ?>

    I'm calling this first unique sidebar menu "about."
    I made a copy of twentyten/sidebar.php and named it dePaulSchool/sidebar-about.php
    I added this code right after the tag for the search form:

    <!-- HERE IS THE UNIQUE MENU FOR THIS SIDEBAR ONLY -->
        <li id="about" class="widget-container">
    
        <?php if ( function_exists ( dynamic_sidebar(1) ) ) : ?>
    
        <?php dynamic_sidebar (1); ?>
        <?php endif; ?>
    
        <!-- END.. UNIQUE MENU FOR THIS SIDEBAR ONLY -->

    I created the template dePaulSchool/about-template.php
    I identified the template in the first comment successfully as it shows in the dashboard.

    I replaced the sidebar call with:

    <!-- This is my call for the unique sidebar -->
    <?php get_sidebar( 'about' ); ?>

    By testing arbitrary text to the sidebar-about.php file, it appears that sidebar-about.php is being ignored and the parent version (sidebar.php) is being displayed instead. Can you help me? I think I am really close here.

    [Please post code or markup snippets between backticks or use the code button.]

  2. patparker100@yahoo.com
    Member
    Posted 2 years ago #

    I have not been using the Twentyten theme much lately but looked at some of my code and found this call to my sidebar which worked:
    <?php include ('wp-content/themes/twentyten-child/sidebarHome.php'); ?>

    Let me know if this helps,

    Pat

  3. patparker100@yahoo.com
    Member
    Posted 2 years ago #

    Ah, just looked at the link you sent and it appears that it should be a <?php include ...?>
    not
    <?php get_sidebar() ?>

  4. Kurt
    Member
    Posted 2 years ago #

    fitzio: I believe the #1 sidebar will be the default sidebar not your custom sidebar. Try using dynamic_sidebar('about').

Topic Closed

This topic has been closed to new replies.

About this Topic