Forums

How to remove sidebar on 1 page, and keep it on the others? (5 posts)

  1. AlxDesign
    Member
    Posted 7 months ago #

    I've been trying to figure it out a bit, but instead of spending more time doing that, I could just ask here.

    http://www.alxdesigns.com/dev/wp/home

    I'd like to have the sidebar on all pages, except on the Gallery page. How do I deactivate it?

    Thanks / Alx

  2. AlxDesign
    Member
    Posted 7 months ago #

    Nevermind. I remade the flash itself, instead.

  3. LenK
    Member
    Posted 7 months ago #

    Hi AlxDesign. Unfortunately I didn't see your post earlier. I see you have taken an alternate route but I'll respond anyway in case you change your mind or for the benefit of others stumbling across this thread.

    You could accomplish this in a couple of different ways.

    1. Through the use of conditional tags OR
    2. By constructing a new template. Also read this. Scroll down about half way to Creating Your Own Page Templates.

    Option #1 - Your Gallery page will be using the page.php template file so look in there for the sidebar call. <?php get_sidebar(); ?> and adjust it to look like this ...

    <?php if (is_page('x')) : ?>
    <?php else : ?>
    <?php get_sidebar(); ?>
    <?php endif; ?>

    ... where "x" is the ID number of that page.

    Option #2 - Build a new template and assign your Gallery page to use it instead of page.php This is not as hard as it sounds. You can make it a complete duplicate of page.php with the exception of the sidebar call of course.

    Be advised that whichever option you, or anyone else chooses, you may want to make further changes. Why? Because now that the sidebar is gone from a certain page you will have a rather strange looking empty space in its place. You would probably want to widen the content area of that page so that it takes up that extra space. You can take a look at the default Kubrick theme to see how this is implemented.

  4. AlxDesign
    Member
    Posted 7 months ago #

    Thanks for that LenK. I will surely use this function on my upcoming themes.

    <?php if (is_page('x')) : ?>
    <?php else : ?>
    <?php get_sidebar(); ?>
    <?php endif; ?>

    That one was really nice and simple. Thanks again.

  5. gavpedz
    Member
    Posted 1 month ago #

    This is great i am am having a bit of trouble though the forum which is the page in question does not stretch across the whole page.
    http://www.iamlizard.co.uk/?page_id=99

    any ideas?

Reply

You must log in to post.

About this Topic