Support » Fixing WordPress » get_sidebar for wordpress 3.0.1

  • I have been trying to change the sidebar in one of my page templates and I haven’t been able to do it, it seems that it’s because I am using wordpress 3.0.1 I need help.

    This is what I have on my page template:

    <?php get_sidebar(); //Include the Sidebar ?>

    Right now it’s pulling the file sidebar.php like my other page templates, but I would like it to pull my file sidebar-2.php

    I have tried numerous things that I’ve found in your forums and on the internet, like:

    <?php get_sidebar(2); //Include the Sidebar ?>

    Or:

    <?php get_sidebar(TEMPLATEPATH . ‘sidebar-2.php’); //Include the Sidebar ?>

    And others, but none of them are working, it either pulls sidebar.php or it pulls an error.

    Please help me because I am going literally “NUTS”!

Viewing 11 replies - 1 through 11 (of 11 total)
  • esmi

    (@esmi)

    Forum Moderator

    Try <?php get_sidebar('2'); ?>

    It didn’t work but thanks, I am not sure what’s going on.
    When I do that it still pulls sidebar.php

    esmi

    (@esmi)

    Forum Moderator

    Try renaming sidebar-2.php to sidebar-two.php and using <?php get_sidebar('two'); ?>

    I tried, and it’s not working, I also tried many different names.

    I found this on the wordpress help forum but I can’t really understand what it means and what should I write:

    get_sidebar (line 82)

    Load sidebar template.

    Includes the sidebar template for a theme or if a name is specified then a specialised sidebar will be included.

    For the parameter, if the file is called “sidebar-special.php” then specify “special”.

    * since: 1.5.0
    * uses: locate_template()
    * uses: do_action() – Calls ‘get_sidebar’ action.

    void get_sidebar ([string $name = null])

    * string $name: The name of the specialised sidebar.

    esmi

    (@esmi)

    Forum Moderator

    It’s saying that if you have a sidebar template file called sidebar-two.php, you call it using <?php get_sidebar('two');?>. The info at the end relates to advanced coding.

    Check the name of your sidebar template file. If it’s not called sidebar-two.php, then the general sidebar template (sidebar.php) will be used in its place.

    Thank you but that’s exactly what I’m doing and it’s still not working, are there any other options to write this code?

    esmi

    (@esmi)

    Forum Moderator

    You’ve tried them all. Looks like there’s an issue with your sidebar file’s name.

    The name is ok, can it be another type of issue?
    The sidebar is installed ok, it’s showing up on my widgets page…

    I did it!! thanks to all for your help.
    I now have another issue.
    The new side bars are shown, but they’re not aligned:
    http://apostillado.info/espanol
    The sidebar should look lik this one:
    http://apostillado.info/faq
    Do you guys know what could’ve happened?

    and it’s mixing with the page content:
    http://apostillado.info/us-states

    esmi

    (@esmi)

    Forum Moderator

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘get_sidebar for wordpress 3.0.1’ is closed to new replies.