How to force a full-width layout on a page template


I created a page template. However it is getting the default page template with a right sidebar. Is there a way to add a code to the page template so that a single column full width page is forced upon regardless of users layout preferences or default layout.


  • akasya
    • Flash Drive

    Hi Timoty,

    There is no get_sidebar in the page template. Below there is the function that forces upon the sidebar. The custom page layouts are defined.

    /* get the page layout */
    	$custom_page_layout= 'default';
    	if(is_singular(array( 'page', 'post' ))) {$custom_page_layout = get_post_meta( $post->ID, '_cmb_page_layout', true );}		
    	if (($custom_page_layout == 'left-sidebar') || ($custom_page_layout == 'right-sidebar') || ($custom_page_layout == 'full-width') || ($custom_page_layout == 'three-column')) {
    		$bones_layout = get_post_meta( $post->ID, '_cmb_page_layout', true );
    	} else {
    		if (is_page()) {$bones_layout = of_get_option('default_page_layout', 'right-sidebar');}
    		else {$bones_layout = of_get_option('default_blog_layout', 'right-sidebar');}
    		if ($bonesecommerce == true) {
    			if (is_shop()) {$bones_layout = of_get_option('default_shop_layout', 'right-sidebar');}
    			if (is_product()) {$bones_layout = of_get_option('default_product_layout', 'right-sidebar');}

    I tried to add something like this for my page template blog-full-width

    if (is_page_template(blog-full-width.php)) {$bones_layout = of_get_option('default_page_layout', 'full-width');}

    Is this the right way to go. How shall I do it then.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.