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 ?>
<?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”!
It didn’t work but thanks, I am not sure what’s going on.
When I do that it still pulls sidebar.php
<?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.
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?
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…
and it’s mixing with the page content:
- The topic ‘get_sidebar for wordpress 3.0.1’ is closed to new replies.