+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 24

Thread: Different Sidebar per Page?

  1. #1
    Join Date
    Mar 2009
    Posts
    21

    Default Different Sidebar per Page?

    I've noticed in some other WP themes, there's a capability to have a different sidebar for, say, your About page than for your Blog. Wondering if this capability is already built in and, if so, where to find it. If not, how difficult would it be for me to set this up?

    I LOVE the nice clean look of this theme, but would am hoping to use it more for an overall portfolio site (in addition the blog). On one or two pages, I'd like to dispense w/ the Blog roll, links to social media, etc.

  2. #2
    Join Date
    Feb 2009
    Posts
    605

    Default

    I think this is only supported in the latest versions of WP (at least 2.5), so make sure you've upgraded.

    Next, create a new sidebar called sidebar-about.php. The name after the hyphen is what you will want to call in the modified code on your About page.


    (METHOD ONE)

    You can either edit page.php and add an IF statement, like so:

    PHP Code:
    <?php if ( is_page('about') ) { // page slug is about. can also be page title or page ID.
    get_sidebar('about'); // name of the sidebar after the hyphen
    } else {
    get_sidebar();
    ?>

    (METHOD TWO)

    ...or create a Page Template about.php, duplicate page.php but add a name at the top...

    PHP Code:
    <?php
    /*
    Template Name: About
    */ 
    ?>
    ...call get_sidebar('about'); instead of get_sidebar()...

    ...and then assign this Page Template to About when you edit the page in your admin.



    Obviously method one is quicker.



    More information:

    get_sidebar()
    http://codex.wordpress.org/Function_...ce/get_sidebar

    is_page()
    http://codex.wordpress.org/Function_Reference/is_page




    Quote Originally Posted by EWKrause View Post
    I've noticed in some other WP themes, there's a capability to have a different sidebar for, say, your About page than for your Blog. Wondering if this capability is already built in and, if so, where to find it. If not, how difficult would it be for me to set this up?

    I LOVE the nice clean look of this theme, but would am hoping to use it more for an overall portfolio site (in addition the blog). On one or two pages, I'd like to dispense w/ the Blog roll, links to social media, etc.

  3. #3

    Default How to create a php file?

    I'd also like to have a custom sidebar for each page...but how do I go about making a php file in this example? That's where my confusion lies...

    I'm hosting wordpress on GoDaddy and REALLLLY want to have a custom sidebar with different info (upcoming events, album links, etc.) on each page.

    My site is www.elephantmemories.com

    Thank you for any and all help. Again, you rock.

  4. #4
    Join Date
    Feb 2009
    Posts
    605

    Default

    Just use Notepad or some other text editor, save it as sidebar-something.php, and upload it to the theme folder.

    Just make sure it has the right extension. I suggest you download and install something like Notepad++ for code editing on your desktop.




    Quote Originally Posted by ElephantMemories View Post
    I'd also like to have a custom sidebar for each page...but how do I go about making a php file in this example? That's where my confusion lies...

    I'm hosting wordpress on GoDaddy and REALLLLY want to have a custom sidebar with different info (upcoming events, album links, etc.) on each page.

    My site is www.elephantmemories.com

    Thank you for any and all help. Again, you rock.

  5. #5
    Join Date
    Aug 2009
    Posts
    13

    Default

    Hi! I have a similar question.

    My website is www.unbridledenthusiast.com


    I want my 'about' page to have only the 'about unbridled enthusiast' part and I'd like it to be left aligned, not centered. Meaning, I don't want it to have either sidebar or margins. Can you please let me know if this is possible?

    Thank you!

  6. #6
    Join Date
    Aug 2009
    Posts
    13

    Default

    I got this working! I included php if(!is_page('about')){ in the editor under page.php for the right and left sidebars.

    Now I'm going to try to apply the same logic to that column width so that the text goes across the page, as opposed to being limited to the width of this column.

    Am I on the right path?


    Quote Originally Posted by advocatel View Post
    Hi! I have a similar question.

    My website is www.unbridledenthusiast.com


    I want my 'about' page to have only the 'about unbridled enthusiast' part and I'd like it to be left aligned, not centered. Meaning, I don't want it to have either sidebar or margins. Can you please let me know if this is possible?

    Thank you!

  7. #7
    Join Date
    Feb 2009
    Posts
    605

    Default

    Hmmm it looks like you got things working already. You might want to add

    Code:
    padding: 0;
    as well. Is there anything else you wanted to do?

    I was going to recommend the use of <?php body_class(); ?> so it can apply to more than just the about page but if you're not going to touch other pages then this can work just fine.

    Recommended reading in case: http://www.nathanrice.net/blog/wordp...lass-function/





    Quote Originally Posted by advocatel View Post
    I got this working! I included php if(!is_page('about')){ in the editor under page.php for the right and left sidebars.

    Now I'm going to try to apply the same logic to that column width so that the text goes across the page, as opposed to being limited to the width of this column.

    Am I on the right path?

  8. #8
    Join Date
    Aug 2009
    Posts
    13

    Default

    Hi! Thanks so much for replying. I did get it to work and I'm sorry I didn't let you know. My boss actually helped me with it, he's a pro. He suggested that for the width I use .css instead of messing around with .php, but when we went into the editor, we realized that there is no unique classification for any of the pages. He went ahead and created it for the 'about' page in the page .php. It happened so fast, I was so confused!

    then, he went ahead and just created a rule in .css under #content, which allowed me to have what I want.

    I realized later on that I actually want to do similar changes for other pages as well, but I didn't want to bug him anymore. I will read through the link you gave me. thank you for that!

    One last thing (yea right). I was trying to figure out how to make new posts in the pages other than the home page. I know that I can make as many entries as I'd like on the home page, but when I looked around under "Pages" in the Cutline theme, I noticed that I can only make one post. Am I just not seeing the option for making as many entries as I want?

    thanks again for your help, I really appreciate you taking the time.

    Yelena

  9. #9
    Join Date
    Feb 2009
    Posts
    605

    Default

    Yes, that's why I also mentioned adding body_class(); to the body so you'd have a class that's above the content area.

    I'm not sure what you mean by the "Pages in the Cutline theme" . Pages are static as opposed to posts which are date-based, so each page is just that... one page. It doesn't make sense to have multiple posts in a page...except if you want to list posts in an archives/category/date page or something similar. Again, I'm not sure what you wanted to achive with what you're saying so if you can expound a little bit more, thank you.



    Quote Originally Posted by advocatel View Post
    Hi! Thanks so much for replying. I did get it to work and I'm sorry I didn't let you know. My boss actually helped me with it, he's a pro. He suggested that for the width I use .css instead of messing around with .php, but when we went into the editor, we realized that there is no unique classification for any of the pages. He went ahead and created it for the 'about' page in the page .php. It happened so fast, I was so confused!

    then, he went ahead and just created a rule in .css under #content, which allowed me to have what I want.

    I realized later on that I actually want to do similar changes for other pages as well, but I didn't want to bug him anymore. I will read through the link you gave me. thank you for that!

    One last thing (yea right). I was trying to figure out how to make new posts in the pages other than the home page. I know that I can make as many entries as I'd like on the home page, but when I looked around under "Pages" in the Cutline theme, I noticed that I can only make one post. Am I just not seeing the option for making as many entries as I want?

    thanks again for your help, I really appreciate you taking the time.

    Yelena

  10. #10
    Join Date
    Aug 2009
    Posts
    13

    Default

    I'm sorry I was so confusing.

    What I want to do with www.unbridledenthusiast.com is be able to make new posts on pages other than the homepage. For example, in my recipes page, every time I add a new recipe, I want it to be its own entry. Right now I can make one entry and the only option I'd have to add more recipes, is to just keep editing the one post. It works great for the 'about' page, because I'll never need to add different posts.

    Is that possible?

    I think I'm starting to understand what you're saying though. Every new post I make on the homepage can just be archived on different pages. So each time I make a recipe post, all I have to do is classify it as a 'recipes' in archives and when someone wants a list of recipes, they'll just go to that page. Am I correct in thinking that? I'm guessing what I can do is each time I publish a recipe post, I'll just edit the Recipe page by adding the links to those recipe posts. Yes?

    I also decided that to eliminate my sidebar issues, I'll just switch to Cutline 2 Columns, because I just don't need that many columns. The only thing is, I want to be able to make my content longer.

    I'm sorry if I sound redundant, this is all so new to me

+ Reply to Thread

Similar Threads

  1. Align the Page Titles to the Center of the Page
    By nailyener in forum Header & Nav Bar
    Replies: 3
    Last Post: 10-31-2010, 02:26 PM
  2. Need to make custom page-template sans R sidebar. How?
    By ceejski in forum Posts, Pages, Comments
    Replies: 6
    Last Post: 10-31-2010, 02:19 PM
  3. How To Move Sidebar to Bottom of Page?
    By I<3GOOGLE in forum Sidebar
    Replies: 3
    Last Post: 03-03-2010, 04:37 AM
  4. sidebar in middle/bottom of page?
    By bedwettingcosmonaut in forum Sidebar
    Replies: 1
    Last Post: 01-07-2010, 09:49 AM
  5. No ads in the sidebar - help :-(
    By ianjmatt in forum Sidebar
    Replies: 1
    Last Post: 09-15-2009, 04:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts