• HI,
    I am trying to create a page template with full-width to use as a front page and for specific pages.

    I added a full-width.php file with the same content as page.php, except for the page template name. I then added the class fullwidth here

    <div id="primary" class="content-area fullwidth">

    and in style.css I added

    .fullwidth {
    	margin: 0 auto;
    	max-width: 1100px;
    	width: 100%;
    }

    but, unfortunately, nothing changed.

    can anyone help with this?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi sigul77,

    First give a template name to ‘full-width.php’ in starting of template. See Below:
    <?php
    /**
    * Template Name: Home Page
    *
    */
    get_header();
    ?>
    and after you need create a page in wordpress admin panel and assign this template to the newly created page.

    Thread Starter sigul77

    (@sigul77)

    yes I already done this.
    the problem is with this line of code in the header

    <div id="content" class="site-content">

    that request to create a different header for full width page

    I created another header called header-fullwidth.php and modified that line with

    <div id="content" class="site-content fullwidth">

    This code works, but I can’t load the new header in fullwidth.php with this call

    <?php
    /**
     *
     * Template Name: Full Width
     *
     * @package Graphy
     */
    
    get_header( 'fullwidth' ); ?>

    assign this name to new header file like this: “header-fullwidth.php”

    Thread Starter sigul77

    (@sigul77)

    I did. still nothing changed

    can u plz send me a link if its live

    plz Remove the class ‘site-content’ or change the width in style.css of ‘site-content’ class.

    Thread Starter sigul77

    (@sigul77)

    yes. I am working here https://37.60.241.80/~cristi43/silviogulizia.com/ebook/

    thanks for helping

    Thread Starter sigul77

    (@sigul77)

    I am trying even another way: modify that line with an if statement

    <?php if ( is_page('ebook') ) {
    		<div id="content" class="site-content fullwidth">;
    } else {
    	 <div id="content" class="site-content">;
    	}
    ?>

    but I am getting error “unexpected <”

    no need to write if condition. Simple Just create different template for ‘ebook’ and write your customs classes.

    Thread Starter sigul77

    (@sigul77)

    I need a Template for ebook and home, the only thing changing is the width of the site-content class. I created a fullwidth class to appen to class definition for content, but as you can see content is defined in the header.php so I need one of two 1) create two header and link the modified one to the full width template 2) use a if statement to define in header.php which page must be fullwidth and which not (by adding a custom class after site-content, and it works, I checked it in live preview editing CSS). Unfortunately not of these approach seems working and I can’t find the error ??

    Thread Starter sigul77

    (@sigul77)

    done!

    the correct way to call a custom header is to rename the file header-fullwidth.php (with the hyphen) and the use get_header (‘fullwidth’)

    yes check my 2nd reply
    i am also suggest this to rename header like “header-fullwidth.php”

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to create a full-width page template?’ is closed to new replies.