• 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?

    https://www.oceanviewrickshaw.com/pedicabs

    Thank you in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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');
    Thread Starter onajide

    (@onajide)

    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.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘excluding sidebar’ is closed to new replies.