WordPress.org

Ready to get started?Download WordPress

Forums

excluding sidebar (4 posts)

  1. onajide
    Member
    Posted 6 years ago #

    I've looked at several sources, read many things but, come away still confused. I have a site I'm trying to modify. I want to create a series of pages within the site that will not have a sidebar and, I'm stumped as to how best to go about it.

    I understand I can use an "exclude" but, since my theme doesn't have a pages.php, don't I also have to create one in order for the layout to have something to render with or to?

    http://www.oceanviewrickshaw.com/pedicabs

    Thank you in advance

  2. chaoskaizer
    Member
    Posted 6 years ago #

    well if you still have your index.php or any available template files inside your theme directory. You can try the following tricks.

    find all

    <?php get_sidebar(); ?>

    replace with

    <?php if (is_page() == false) get_sidebar(); ?>

    Extra css, the below code will make the right content fill up the sidebar space.

    add it inside functions.php

    function custom_page_css()
    { global $wp_query;
    	if ($wp_query->is_page){
    ?>
    	<style type="text/css">
    	/*<![CDATA[*/
    	#content{width:858px}
    	/*]]>*/
    	</style>
    <?php
    	}
    }
    
    add_action('wp_head','custom_page_css');
  3. onajide
    Member
    Posted 6 years ago #

    Thanks. So, I create pages.php by copying index.php and insert the above code? Or, only replace the code on index.php?

    for clarification: I DO want the sidebar to show where it currently is showing. I want to create a new set of pages where the sidebar will not show.

  4. chaoskaizer
    Member
    Posted 6 years ago #

    u could mod the index.php the code will disabled/exclude the sidebar on "page" sections only.

Topic Closed

This topic has been closed to new replies.

About this Topic