ThemeShaper Forums » Thematic

[closed]

Remove sidebar on all pages but blog or create a sidebar-less page template

(11 posts)
  • Started 4 years ago by onto
  • Latest reply from j.dalen
  • This topic is resolved
  1. onto
    Member

    Hi guys,

    first of all many thanks for the Thematic Framework. It's awesome! I'm a Wordpress n00b, so bear with me if I ask for something stupid or hard to solve.

    I'm using a modded Street Child theme (http://www.cozmoslabs.com/2009/06/02/street-wordpress-theme/) by the way.

    I have two questions:

    • I'm designing a new website and I'd like to remove the sidebar on all site pages except the blog and it's blog posts. How do I do this? I know how to remove the sidebar from single pages (tutorial here: http://www.elshaddai-edwards.com/2010/01/remove-sidebar/) but it's a hassle to manually add exceptions to the functions.php and style.css. I was hoping for an easier solution, preferably one that doesn't also make me modify the style.css.
    • Related to the first question: Is there a way to use page templates for Thematic in the same way as the Hybrid Framework? I recall that somebody converted the Hybrid page templates (http://themehybrid.com/archives/2009/11/hybrid-page-templates) to Thematic, but I can't find the site or a download any more. What I'm after are preconfigured page templates which make it easy to create new page e.g. a page without asides or an archive page. Unfortunately I don't know any PHP else I would have created a such page templates myself.

    Many thanks for your help!

    onto

    Posted 4 years ago #
  2. You could copy page.php into your child theme directory, and then delete the lines:

    // calling the standard sidebar
        thematic_sidebar();

    You'd also have to update the css. You could target pages using the body tag, ie body.page #container { }.

    For pages where you did want a sidebar, you could use a page template.

    Here's an example of how you would build a template to remove the sidebar, you can borrow most of the code here and reverse it for your purposes: Custom Page Templates in Thematic.

    Posted 4 years ago #
  3. onto
    Member

    Thanks, that seems what I'm after. I'll try this and report back!

    By the way, do you or does anybody know if somebody has converted the aforementioned page templates of the Hybrid Framework to Thematic? If yes, where can I download them?

    Posted 4 years ago #
  4. onto
    Member

    Hi, I tried the suggestion to create custom page templates when I noticed that the street theme already has a full-page no-sidebar page template. I'm dumb!

    In case somebody else is searching for this: Page templates can be choosen when editing a site.

    Posted 4 years ago #
  5. onto
    Member

    Hi, I tried the suggestion to create custom page templates when I noticed that the street theme already has a full-page no-sidebar page template. I'm dumb!

    In case somebody else is searching for this: Page templates can be choosen when editing a site.

    Posted 4 years ago #
  6. i probably found this on the forum but here is what i use to get rid of the sidebar on static home pages that are not the blog:

    // filter thematic_sidebar() ... switch off on static home page
    function remove_sidebar() {
     // We test if we are on the front page
     if (is_front_page() and !is_home()) {
     // Yes, we are .. now we switch off the sidebar
     return FALSE;
     } else {
     // we are not .. we leave the switch on
     return TRUE;
     }
    }
    // Connect the filter to thematic_sidebar()
    add_filter('thematic_sidebar', 'remove_sidebar');

    so in your case, i'd probably try switching that around:

    // filter thematic_sidebar() ... switch off on static home page
    function remove_sidebar() {
     // We test if we are on the front page
     if (is_home() or is_single()) {
     // Yes, we are .. leave on
     return TRUE;
     } else {
     // we are not .. switch off
     return FALSE;
     }
    }
    // Connect the filter to thematic_sidebar()
    add_filter('thematic_sidebar', 'remove_sidebar');
    Posted 4 years ago #
  7. towsondcr
    Member

    @Helga...Hi Helga. Thank you for this information. But the last time I tried to paste in a php code I really jacked up my site and had to start all over. So, besides making the changes in the pages, is there a particular way to paste this code into my functions.php? Do I do it in wordpress or do I need to download it, paste it in, and then re-upload? I know really nothing about php so I am really hesitant to mess with it but this seems relatively simple.

    Please help

    Posted 4 years ago #
  8. @towsondcr - you are going to have to be willing to cut and paste code in order to learn something about child themes and thematic. if you are not, you should probably consider hiring someone.

    that said, if you do a child theme correctly you shouldn't be able to really mess up your site. you can always delete your child's functions.php to recover from whatever error you've just made...or super worst case you can switch back to default theme. i also think it is essential to develop on your own local server. it saves time AND keeps you from royally destroying anything in a live environment. google how to set up wordpress on XAMMP.

    you didn't really say what exactly you are attempting to do, but since you bumped this thread you must be looking for a full-width page template? the easiest solution might be to use the template Devin posted on his site. the link is above for Custom Page Templates in Thematic.

    Posted 4 years ago #
  9. Helga, thanks for the filter thematic_sidebar() code - exactly what I was looking for. If I wanted to remove just primary or secondary from certain category pages, would this be correct:

    // filter thematic_sidebar() ... switch off on category-painting and category-drawing
    function remove_sidebar('primary') {
     // We test if we are on either category-painting or category-drawing
     if (is_category('drawing') || is_category('painting')) {
     // Yes, we are .. now we switch off the sidebar
     return FALSE;
     } else {
     // we are not .. we leave the switch on
     return TRUE;
     }
    }
    // Connect the filter to thematic_sidebar('primary')
    add_filter('thematic_sidebar', 'remove_sidebar');
    // ....Repeat for thematic_sidebar('secondary').....

    Actually, now that I look this over, I suspect it might not work. In order to:
    1) Check if we're on category-drawing or category-painting
    2) If so, switch off primary sidebar
    3) If so, switch off secondary sidebar
    what needs to happen?
    (I want to keep the other widget areas so I was afraid to just use blanket sidebar.)

    Posted 4 years ago #
  10. Update: Please disregard the above - I remembered that thematic_sidebar() only encompasses primary and secondary anyway. I went ahead and used Helga's remove_sidebar() function pretty much as is.

    Posted 4 years ago #
  11. Can someone help me modify the above code to get rid of subsidiaries on certain page templates? I have already moved the subsidiary section under _belowmainasides (so it is within the main container, above the footer)

    I tried the below, but it's incorrect:

    // filter thematic_subsidiaries ... switch off on certain page templates and blog page
    function remove_belowmainasides() {
    // We test if we are on the front page
    if (is_page('standard') or is_single()) {
    // Yes, we are .. leave on
    return TRUE;
    } else {
    // we are not .. switch off
    return FALSE;
    }
    }
    // Connect the filter to thematic_subsidiaries()
    add_filter('thematic_belowmainasides()', 'remove_widget_area_subsidiaries');

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.