I’m creating a Page Template for a WordPress site.
In the file newpagetemplate.php I currently have this code, and this code only:
<html>
<body>
<?php
/*
Template Name: Salespage
*/
?>
<div>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
</div>
</body>
</html>
I’ll need to make amendments, to set values for margins, fonts etc.
In the above code, do I need the ‘html’ and ‘body’ tags?
(If I take those tags out, a page with this page template applied still displays ok.)
I don’t know why you’re receiving so many theoretical answers. That to me seems like an uninteresting waste of time.
The simple answer is No.
From the code you provided, it looks as though you’re trying to build a custom WordPress theme. You’ll want to place the doctype and opening html/body tags in
header.php, and close those tags infooter.php. You then pull in the header and footer templates from your ‘Salespage’ template. It may look a little something like this:// header.php// newpagetemplate.php// footer.php