ThemeShaper Forums » Thematic

Revision 366 - Remove Sidebar

(4 posts)
  • Started 15 years ago by Chris
  • Latest reply from Chris
  • This topic is not a support question
  1. Upon request:

    The main sidebar is now switchable using a filter in your functions.php:


    function kill_sidebar() {
    return FALSE;
    }
    add_action('thematic_sidebar', 'kill_sidebar');

    This will remove the sidebar everywhere on your blog. If you want to remove it only on a certain page, you can use this one:


    function kill_sidebar() {
    if (is_page('1') {
    return FALSE;
    } else {
    return TRUE;
    }
    }
    add_action('thematic_sidebar', 'kill_sidebar');

    Keep in mind that this will completely prevent the execution of sidebar.php

    Cheers,

    Chris

    Posted 15 years ago #
  2. I'm getting an error using the second piece of code. I've tried different page ids. Seems to work fine without the page selection. Any ideas?

    <?php
    function kill_sidebar() {
    if (is_page('7') {
    return FALSE;
    } else {
    return TRUE;
    }
    }
    add_action('thematic_sidebar', 'kill_sidebar');
    ?>

    EDIT: missing a bracket, problem solved.

    Posted 15 years ago #
  3. It seems a closing parenthesis is missing in the example. The if line should read:

    if (is_page('1')) {

    Edit: Didn’t notice your EDIT. :-D

    Posted 15 years ago #
  4. Sorry .. missed the bracket .. will start to re-test all of my code snippets today and publish these snippets including downloads on my website. Availability and link will be published 'til Sunday.

    Cheers,

    Chris

    Posted 15 years ago #

RSS feed for this topic

Reply

You must log in to post.