How do I make page-specific Sidebars?
-
Hello fellow WP peeps. I have a website, http://www.jbdaigle.com, that I’m using to help me find a job. The sidebar content I have on my home page is way too much to fit in a few of my other pages/tabs. When the page content ends, the sidebar content just kind of stops being in a sidebar and goes underneath the page content. see here: http://jbdaigle.com/job-requirements/
My question is, how do you make sidebar content page-specific, so that I can put less side bar content on short pages like the one above?
I tried using a couple of plugins to do this, but didn’t have any luck because the instructions, I think, assumed much more experience with we design than I have–this is my first site.
If you could help me out, that would be awesome!
-
Do you mean page specific or category specific? There is a difference.
First thing you should do is fix your missing closing tags and other code errors that are sending the sidebar elements under your content: [Invalid]Markup Validation of jbdaigle.com job-requirements – W3C Markup Validator. Scroll down in the valdiation report to see line numbers and source code.
Then you can use some php in the sidebar to selectivly load widgets, like Customizing Your Sidebar « WordPress Codex.
@thetvstop: I mean page-specific
@songdogtech: Thanks for your input. I’ll see what I can do with the code. This is my first website, so I’m kind of overwhelmed with the code stuff. Thanks for pointing me in the right direction
If you wish to do this manually you can do something like this:
<?php if (is_page(array ('2759','2785','2788','2792','4180'))) { include(TEMPLATEPATH . '/sidebar/pagespecificside.php'); }elseif (is_page(array('2857','36'))) { include (TEMPLATEPATH . '/sidebar/pagespecificside.php'); }else{ include(TEMPLATEPATH . '/sidebar.php'); } ?>Change pagespecificside.php to the name of your php file, also change /sidebar/ to the directory in which your new sidebar is.
The topic ‘How do I make page-specific Sidebars?’ is closed to new replies.