WordPress.org

Forums

Remove sidebar for one specific page? (11 posts)

  1. Ramiuz
    Member
    Posted 4 years ago #

    Is it possible to have a sidebar with widgets disappear when opening one specific page?

    I have a page where I have a huge dynamic timeline embedded. And I would like for this timeline to get the entire width of the website to shine. So that means, the widgets should go away for this one page, but stay normal for all the others.

  2. keesiemeijer
    moderator
    Posted 4 years ago #

    conditional tags: is_page()

    <?php
    if(is_page('42') ){ // Page ID = 42
    // do stuff
    }
    ?>
  3. antorera
    Member
    Posted 4 years ago #

    Also, depending on your theme, you should be able to select the "Full Width" template under Page attributes on a page level (found on the right sidebar of the edit page, under the Publish box). This is a pretty standard template included with most themes.

  4. Ramiuz
    Member
    Posted 4 years ago #

    I dont see any such attribute. And I don´t understand your post keesiemeijer.
    I have three quite great themes, F8-lite, Mystique, and Anvil. None of them has a full width option.
    -
    Edit: Sorry, Mystique has it, but if I don´t use this theme, I´m gonna have to create the page template myself. Is that easy?

  5. antorera
    Member
    Posted 4 years ago #

    If you have a little coding experience with WP, it should not be difficult to create it yourself.

    You can start by reading up a little here:
    http://codex.wordpress.org/Theme_Development

    and then look at how the Mystique theme does it as a model.

    Basically, you can take the page.php template and remove the call to the sidebar and also you might have to modify or create some new styles in the stylesheet. (Again, use the Mystique theme to see if they do any special styles for the full-page width container. You may have to modify a width setting somewhere.)

  6. antorera
    Member
    Posted 4 years ago #

    If you have a little coding experience with WP, it should not be difficult to create it yourself.

    You can start by reading up a little here:
    http://codex.wordpress.org/Theme_Development

    and then look at how the Mystique theme does it as a model.

    Basically, you can take the page.php template and remove the call to the sidebar and also you might have to modify or create some new styles in the stylesheet. (Again, use the Mystique theme to see if they do any special styles for the full-page width container. You may have to modify a width setting somewhere.)

  7. Ramiuz
    Member
    Posted 4 years ago #

    Interesting, I think I might do what you say and remove the call of the sidebar. I´ve done things like that before.

    Removing and rearranging PHP code is not a problem, but writing it is.

    Does it work the other way around too? Because I have a theme called F8 Lite, and would like to ADD a sidebar to that in the posts field..?

  8. antorera
    Member
    Posted 4 years ago #

    I'm like you! I can rearrange, but not write.

    Yes, you can also add sidebars (or bottom widgets too!) - although it might be more advanced. You need to do some reading up on the theme development page and searches on google and wordpress forums to show you how. There are a few files you have to touch to make the call. In your case it would be the posts page template, the sidebar.php and maybe the function.php and style.css for starters...

    Good luck!

  9. keesiemeijer
    moderator
    Posted 4 years ago #

    You can do it on all your theme's template files where you call the sidebar <?php get_sidebar(); ?>

    <?php
    if( !is_page('42') ){ // show sidebar when it is not a Page with ID 42
    <?php get_sidebar(); ?>
    }
    ?>

    or in the sidebar template sidebar.php. Put the content of your sidebar.php in the pastebin and link back to it here.

  10. Ramiuz
    Member
    Posted 4 years ago #

    I´m gonna solve this by recreating my website based on Mystique. An absolutely kickass theme that has all I need.

    But how can I add a sidebar to this home.php for GraphPaperPress´F8 Lite theme, which has no sidebar at all:

    <?php get_header(); ?>
    
    <?php $i = 0; ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); $i++; ?>
    <div class="span-8 post-<?php the_ID(); ?><?php if ($i == 3) { ?> last<?php  } ?>">
    <h6 class="archive-header"><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title() ?></a></h6>
    <?php get_the_image( array( 'custom_key' => array( 'thumbnail' ), 'default_size' => 'thumbnail', 'width' => '310', 'height' => '150' ) ); ?>
    <?php the_excerpt(); ?>
    <p class="postmetadata"><?php the_time( get_option( 'date_format' ) ); ?> | <?php comments_popup_link('Comments »', '1 Comment »', '% Comments »'); ?></p>
    </div>
    <?php if ($i == 3) { ?><div class="archive-stack clear"></div><?php $i = 0; } ?>
    <?php endwhile; endif; ?>
    
    <div class="clear"></div>
    
    <div class="navigation clearfix">
    	<div><?php next_posts_link('« Older Entries') ?></div>
    	<div><?php previous_posts_link('Newer Entries »') ?></div>
    </div>
    
    <?php get_template_part( 'bottom' ); ?>
    <?php get_footer(); ?>
  11. Ramiuz
    Member
    Posted 4 years ago #

    Also worth noting that the F8 Lite theme does not have a sidebar. So this needs to be made from scratch.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.