• I have started learning how to put wordpress themes together… however I am slightly confused… I have been making websites for quite some time, but my normal technique doesn’t appear to work.

    I normally create a single container and build everything inside of that container… This has worked when I entered the wordpress shortscript tags, however the container stops at the header.

    The problem lies where I split the page into the header, sidebar, index and footer files. WordPress seams to think that the body tag ends at the end of the header tag.

    Is this just a case of entering the container into the index? The opening container tag at the begining and the closing tag at the end with the get_header etc. tags inside of them?

    Here is my test site…
    https://www.iansalter.co.uk/wp-playground

    The dashed lines are the container tags.

Viewing 6 replies - 1 through 6 (of 6 total)
  • body tags should start in header.php and ends in footer.php

    get_header and get_footer functions in your index.php file, along with get_sidebar.php

    Thread Starter lamborgini8

    (@lamborgini8)

    That’s how I have done it but it doesn’t appear to work…

    My header.php file is…

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
    <link href="style.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
    <div id="container">
      <div id="header">Content for  id "header" Goes Here</div>

    …and footer.php…

    <div id="footer">Content for  id "footer" Goes Here</div>
    </div>
    </body>
    </html>

    The only thing in the index.php is

    <?php get_header(); ?>
      <div id="content"><?php the_content('Read the rest of this entry &raquo;'); ?></div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    it is a floating issue – because the other divs are floated, the #container div does not get extended to the bottom (the #footer is outside of it anyway).

    search online for ‘clearfix’ or ‘clearing floats’ or so.

    Thread Starter lamborgini8

    (@lamborgini8)

    Given that a try and I have no idea if it has fixed it or not… it has added a huge darkened box with a 5px border to the header…

    Not sure what you mean by the footer is outside of it? If you put it all back together into a single index.html file then it all works perfectly.

    Thread Starter lamborgini8

    (@lamborgini8)

    Right this really does not make sense to me at all… I have followed a guide I came across online and the script they used is identical to the format I have…

    Here is the original html code which works perfectly.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Wordpress Theme</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    </head>
    
    <body>
    <div id="container">
      <div id="header">Content for  id "header" Goes Here</div>
      <div id="content">Content for  id "content" Goes Here</div>
      <div id="sidebar">Content for  id "sidebar" Goes Here</div>
      <div id="footer">Content for  id "footer" Goes Here</div>
    </div>
    </body>
    </html>

    Actually, WordPress doesn’t care where you split your content. You just need to be consistent across all template files.

    You could put everything in index.php, and not use get_header() and get_footer()

    The get_header() and get_footer() template tags are, essentially, nothing more than fancy include() functions.

    What is the actual issue that you’re having? Is your page not rendering properly? Are you not getting the expected output?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Theme Creation Page Body’ is closed to new replies.