WordPress.org

Forums

HTML only page (13 posts)

  1. redsoxmaniac
    Member
    Posted 6 years ago #

    I am looking for a way to make a HTML-only page. I don't want anything else but the code I am putting in ( no header, no footer etc. ). Is there an easy way of doing this or a tutorial out there that can help?

  2. Michael Fields
    Themer
    Posted 6 years ago #

    I would suggest that you make a Custom Page Template. The only php you will need to use is a comment at the top of the document, after that you can put any html that you want:

    <?php
    /*
    Template Name: Custom HTML Page
    */
    ?><ENTER YOUR HTML HERE>

    Upload this file to your current themes directory. Log into WordPress. Create a new page, enter a title and apply this Template. All there is left to do is Publish. Using this method, you can have a static html page that will still show up in wp_list_pages();

  3. mugger
    Member
    Posted 6 years ago #

    I tried it in WP 2.81. All I see is blank display, not my HTML.

  4. Mark / t31os
    Moderator
    Posted 6 years ago #

    I'll break it down a little more...

    Create a file, named whatever you want, but call it something unique, say ... "mytestfile.php"...

    In that file place this..

    <?php
    /*
    Template Name: mytestfile
    ?>
    YOUR HTML GOES HERE!

    Put that file in your theme folder (if it's not there already)...

    Now create a page via the WordPress admin, and select the new template from the Page Templates (you'll see it on the right)...

    You need to enter anything into the content area, just give the page a title, then click Publish...

    Now go view your WordPress Page... :) and you'll only see the code you placed where i put "YOUR HTML GOES HERE!" in the example above..

  5. mugger
    Member
    Posted 6 years ago #

    Several sources say the same thing, yet I display ZILCH, NICHTS, NADA.
    Only if I put the HTML in the supposed template.php do I see my code without usual [default] headers, sidebars. Of course, that defies concept of TEMPLATE usuable for many pages.

    I believe my own eyes. I'd like to see YOUR results.

  6. Mark / t31os
    Moderator
    Posted 6 years ago #

    Your page may still be grapping code from your theme's page.php...

    So in your page.php, wrap the get_header, footer and sidebar functions in a small check for your page...

    get_header()

    becomes...
    if(!page('X')) { get_header(); }

    where X is the page id or name...

    Do the same for the footer and sidebar functions....

    Does that help?

  7. iridiax
    Member
    Posted 6 years ago #

    What is the URL of the problem page?

  8. mugger
    Member
    Posted 6 years ago #

    New site http://hdtv-led.info/ has Default and another theme installed.

    Description http://hdtv-led.info/template-test-cases/
    Example of HTML http://hdtv-led.info/html-in-template/
    Example of blank display http://hdtv-led.info/template-name-here/

    Conclusion:
    I can put HTML code into a supposed "template.php" and view it,
    but a blank named template shows blank display. Both cases
    suppress the usual header/footer/sidebars etc. Both cases
    ignore text entered thru PageEdit.

    Various WP docs had said that I can define a template to merely select in place of the default page template, but this does not work for me. On another site, added templates did not even show up in the PageEdit pull down.

  9. esmi
    Forum Moderator
    Posted 6 years ago #

    <?php
    /*
    Template Name: mytestfile
    ?>
    
    <?php get_header(); ?>
    
    [ type your HTML in here ]
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>
  10. mugger
    Member
    Posted 6 years ago #

    I DO NOT WANT default header. That is the whole purpose -- to put a non WP page into the WP system.
    esmi, are you saying the work should all be done in user.php, not in PageEdit? If so, you confirm my conclusion.

  11. esmi
    Forum Moderator
    Posted 6 years ago #

    I DO NOT WANT default header. That is the whole purpose -- to put a non WP page into the WP system.

    You could try extracting just the tags needed from header.php (eg wp_head()) and place them in your new header file within the theme folder. Then, in place of get_header(), try using <?php include(TEMPLATEPATH.'/header,new/php');?>. If you don't want to the header file in your theme folder, use ABSPATH instead of TEMPLATEPATH.

    http://codex.wordpress.org/Integrating_Wordpress_with_Your_Website

    might give you some more ideas - albeit that you want to do the exact opposite.

  12. mugger
    Member
    Posted 6 years ago #

    thanks

  13. mugger
    Member
    Posted 6 years ago #

    Several weeks later, my understanding is greater but not complete.

    This is an example of template which shows default header, custom
    html, and controls width.
    html2b.php

    <?php /* Template Name: HTML2b */ ?>
    <div style="width:50em;">
    <?php get_header(); ?>
    <html>
    <body>
    Hello World, using html in WP page template<br />
    with WP header.<br /><br />
    Width can be set by template <div><br />
    or TABLE constructs.
    </body>
    </html>
    </div>

    Of course, I can omit the header, or add footer.

    What I still want to know is what is the minimal code that will read
    entries made through WP PageEditor, using custom template. Such would let me make new pages inside PageEditor without a new template for every html page.

    Such plugins as rawHTML and runPHP help me place custom content through PageEdit.

    [Sorry I can't delete my faulty Posts.]

Topic Closed

This topic has been closed to new replies.

About this Topic