WordPress.org

Ready to get started?Download WordPress

Forums

get_sidebar for wordpress 3.0.1 (12 posts)

  1. apostilladotcom
    Member
    Posted 3 years ago #

    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"!

  2. esmi
    Forum Moderator
    Posted 3 years ago #

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

  3. apostilladotcom
    Member
    Posted 3 years ago #

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

  4. esmi
    Forum Moderator
    Posted 3 years ago #

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

  5. apostilladotcom
    Member
    Posted 3 years ago #

    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.

  6. esmi
    Forum Moderator
    Posted 3 years ago #

    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.

  7. apostilladotcom
    Member
    Posted 3 years ago #

    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?

  8. esmi
    Forum Moderator
    Posted 3 years ago #

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

  9. apostilladotcom
    Member
    Posted 3 years ago #

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

  10. apostilladotcom
    Member
    Posted 3 years ago #

    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?

  11. apostilladotcom
    Member
    Posted 3 years ago #

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

  12. esmi
    Forum Moderator
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic