Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Abdi Ahmed
PLUS
Abdi Ahmed
Courses Plus Student 1,667 Points

Question about Wordpress Page customization

I have a question about wordpress customization, I have 2 pages "About Page" and "Contact Us", and my goal is to get rid of the right hand side bar. I am using special theme called "Catch".

Can anyone give me some direction how to get rid of this sidebar?

Regards

10 Answers

Caroline Hagan
Caroline Hagan
12,612 Points

Abdi,

In your theme, you'd need a template file for the "about" and "contact pages" - if you do, you may have a bit of code that looks similar to:

<?php get_sidebar(); ?>

You can delete that line, or just comment it out like this:

<?php // get_sidebar(); ?>

If that doesn't work, you'll need to let us see the code in your files.

Dan Gorgone
STAFF
Dan Gorgone
Treehouse Guest Teacher

Another possible solution: Some themes already have page templates built that omit the right sidebar and may refer to them as "full width" page templates. That's something to look for as well in case you're still trying to figure it out.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Dan makes a good point about their being a built in template already that does not include the sidebar.

Caroline is also correct that you can just comment out the sidebar, but you may have to create your own custom template that removes the sidebar, but also sets a full width class to your main content container.

Do you have a link to the theme you are using, I could trying looking to see if they include a template that would suite your needs.

Abdi Ahmed
PLUS
Abdi Ahmed
Courses Plus Student 1,667 Points

Thanks all for your suggestion, I appreciate that. below is the link in case you want help even more:

http://www.somalitechnews.com

Thanks once again

Caroline Hagan
Caroline Hagan
12,612 Points

They claim it has a "full width page" but it just looks the same as the one with the sidebar and all the others :-?

http://catchthemes.com/demo/simplecatch/full-width-page/

Alternatively, they do have a Support area - http://catchthemes.com/support/ - maybe they have particular settings for their themes?

Abdi Ahmed
PLUS
Abdi Ahmed
Courses Plus Student 1,667 Points

Here is the main template file: index.php

<?php /**

  • The main template file. *
  • This is the most generic template file in a Simple Catch theme
  • and one of the two required files for a theme (the other being style.css).
  • It is used to display a page when nothing more specific matches a query.
  • E.g., it puts together the home page when no home.php file exists. *
  • @package Catch Themes
  • @subpackage Simple_Catch
  • @since Simple Catch 1.0 */

get_header();

if( function_exists( 'simplecatch_display_div' ) ) {
    $themeoption_layout = simplecatch_display_div();
}

get_template_part('content'); ?>

</div><!-- #content -->

<?php 
if( $themeoption_layout == 'right-sidebar' ) {
    get_sidebar(); 
}?>

</div><!-- #main --> 

<?php get_footer(); ?

------------------------------------------------oooOooo---------------------------------------------------

content.php starts here

<?php /**

  • This is the template that displays content for index and archive page *
  • @package Catch Themes
  • @subpackage Simple_Catch
  • @since Simple Catch 1.3.2 */ ?>

        <?php if ( have_posts() ) : 
            while( have_posts() ):the_post(); ?>    
    
                <div <?php post_class(); ?> >
                    <?php //If category has thumbnail it displays thumbnail and excerpt of content else excerpt only 
                    if ( has_post_thumbnail() ) : ?>
                        <div class="col3 post-img">
                            <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'simplecatch' ), the_title_attribute( 'echo=0' ) ); ?>"><?php the_post_thumbnail( 'featured' ); ?></a>
                        </div> <!-- .col3 -->  
    
                        <div class="col5">
                    <?php else : ?>
                        <div class="col8">
                    <?php endif; ?> 
                            <h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'simplecatch' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark" ><?php the_title(); ?></a></h2>
    
                            <ul class="post-by">
                                <li class="no-padding-left"><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>" title="<?php echo esc_attr(get_the_author_meta( 'display_name' ) ); ?>"><?php _e( 'By', 'simplecatch' ); ?>&nbsp;<?php the_author_meta( 'display_name' );?></a></li>
                                <li><?php $simplecatch_date_format = get_option( 'date_format' ); the_time( $simplecatch_date_format ); ?></li>
                                <li class="last"><?php comments_popup_link( __( 'No Comments', 'simplecatch' ), __( '1 Comment', 'simplecatch' ), __( '% Comments', 'simplecatch' ) ); ?></li>
                            </ul>
                            <?php the_excerpt(); ?>
                        </div>   
    
                        <div class="row-end"></div>
                </div><!-- .post -->
                <hr />
    
                <?php endwhile;
    
                // Checking WP Page Numbers plugin exist
                if ( function_exists('wp_pagenavi' ) ) : 
                    wp_pagenavi();
    
                // Checking WP-PageNaviplugin exist
                elseif ( function_exists('wp_page_numbers' ) ) : 
                    wp_page_numbers();
    
                else: 
                    global $wp_query;
                    if ( $wp_query->max_num_pages > 1 ) : 
                ?>
                        <ul class="default-wp-page">
                            <li class="previous"><?php next_posts_link( __( 'Previous', 'simplecatch' ) ); ?></li>
                            <li class="next"><?php previous_posts_link( __( 'Next', 'simplecatch' ) ); ?></li>
                        </ul>
                    <?php endif;
                endif; 
                ?>
    
        <?php else : ?>
                <div class="post">
                    <h2><?php _e( 'Not found', 'simplecatch' ); ?></h2>
                    <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'simplecatch' ); ?></p>
                    <?php get_search_form(); ?>
                </div><!-- .post -->
    
        <?php endif; ?>
    

    ----------------------------------------------oooOoo----------------------------------------------------------

page.php file

<?php /**

  • The template for displaying all pages. *
  • This is the template that displays all pages by default. *
  • @package Catch Themes
  • @subpackage Simple_Catch
  • @since Simple Catch 1.0 */

    if( function_exists( 'simplecatch_content' ) ) simplecatch_content();

?> -------------------------------------oooOoo---------------------------------------------------

content-sidebar-no.php

<?php /**

  • This is the template that displays page/post with no sidebar *
  • @package Catch Themes
  • @subpackage Simple_Catch
  • @since Simple Catch 1.3.2 */ ?> <div id="main" class="layout-978">

        <div id="content" class="col8">
            <?php while ( have_posts() ):the_post();
                if( function_exists( 'simplecatch_loop') ) simplecatch_loop(); 
            ?>
                <div class="row-end"></div>
    
                <?php comments_template(); ?> 
    
                <?php endwhile; ?>
    
        </div><!--#content-->
    
        <div class="row-end"></div>
    
    </div><!--#main--> 
    

    ------------------------------------------------------END----------------------------------------------------------

Caroline Hagan
Caroline Hagan
12,612 Points

It does state in your index.php that you pasted in...

<?php 
if( $themeoption_layout == 'right-sidebar' ) {
get_sidebar(); 
}?>

Therefore it must look for some "theme options" somewhere in the Wordpress Admin, do you to have the option to turn-off the sidebar.

If you are still struggling, send me your Wordpress login details to [email removed] and I'll sort it out for you :-)

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Caroline, you're awesome for offering such assistance!

Abdi, you might also just try creating your own custom template based off of the full page template (which Caroline is right - it looks the same as the two column page template).

In that new template, remove the call for the sidebar and add a class to the id="content" div that you can style to be the full width of the id="main" container.

I'd be happy to help if you just email me the full-width template to zac ~at~ teamtreehouse.com.

Abdi Ahmed
PLUS
Abdi Ahmed
Courses Plus Student 1,667 Points

**It is all sorted!!** with out modiyfing a code. There was radio buttons at the botom of text editor where you edit pages that allows you to exclude the sidebar . Thanks Caroline Zac Gordon ( THE HUNTER: relax am just joking!!!!)

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Oh great! Glad you figured it out. I had actually thought of that and should have mentioned that a number of premium themes have this type of option on a page by page basis in addition to choosing templates.