• Resolved afurth

    (@afurth)


    I am using a TwentyEleven child theme, and now I am trying to create a template for a “blank page”, meaning a page that has No header, No Sidebar, No footer but STILL looking like all the other pages on my website (background and fonts, basically).

    I know this has been answered in this forum for other themes but I am quite new to modifying themes in WP and can’t figure out how to apply the general solution to the specifics of TwentyEleven.

    Thanks in advance!

Viewing 7 replies - 1 through 7 (of 7 total)
  • I usually do this a couple of different ways.

    One way is to create copies of your header.php and footer.php pages … something like header-blank.php or footer-blank.php. In these files strip out the top and bottom navigation as well as the sidebar.

    Then on your template page (which I’ll call blank.php) instead of the

    get_header();

    I use:

    $root=$_SERVER['DOCUMENT_ROOT'];
    include $root . '/wp-content/themes/your-theme/header-blank.php';

    Not sure if this is the best way … but I like doing it this way because if I screw something up in the header it only effects the Blank Template pages.

    Or, you could do it this way in the actual header.php and footer.php file:

    if ( is_page_template('blank.php') ) {
        // what to show on the Blank Template pages
    } else {
        // what to show on all other pages
    }

    another possibility, mash everything (code of a cleaned up header.php, page.php code, code of a cleaned up footer.php) into one file;

    example:
    http://pastebin.com/ZiteZrUX

    in case you are not familiar with page templates: http://codex.wordpress.org/Pages#Page_Templates

    Thread Starter afurth

    (@afurth)

    @originweb, sorry if I sound too dumb, but I frankly have no clue of what code to delete in the copies of the heather.php and footer.php files, I would be extremely grateful if you could point out which lines of code in these files you mean when you say “In these files strip out the top and bottom navigation as well as the sidebar.”

    @alchmyth, do you mean it is enough for me to paste the code you provided in your post to a blank .php file and upload it to my child theme folder? Again, sorry for being so basic, but just starting out in this whole theme-modification thing…

    Thread Starter afurth

    (@afurth)

    @originweb, I tried your solution and got the blank page, but for some reason it is also eliminating the background and font format that I want to keep…

    @alchmyth, do you mean it is enough for me to paste the code you provided in your post to a blank .php file and upload it to my child theme folder?

    yes – create a new blank php file, possibly named blank-page-template.php or whatever name will not conflict with the reserved names (http://codex.wordpress.org/Template_Hierarchy), paste the code into it, and upload it.

    Thread Starter afurth

    (@afurth)

    Wow!

    @alchymyth, that worked like magic! Thank SO MUCH for your help!

    what code to delete in the copies of the heather.php and footer.php files

    have you made the effort to check from the page template, which parts of header.php and footer.php got ommitted?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Creating a "blank page" template for Twentyeleven theme’ is closed to new replies.