Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So I'm taking my first foray into creating a wordpress page template. I created a .php file with the following contents:

<?php
/*
Template Name: Download Page Template
*/
?>

Then I created a page in the page editor and assigned it to use the "download page template". However, when I preview this page, all I see is the home/index page ... I tried a few of the samples from the codex, but all that happened is that my content from the wp editor showed up at the very bottom of the index page.

Am I missing something obvious?

share|improve this question

1 Answer 1

If the code you posted above is all of your file contents then Yes you are missing something!

you just created a new page template but it's empty, you need to tell WordPress what to display, and usually its done using the loop and a few other template tags add this code to you a.php under what you already have :

//this will include the theme header.php file
<?php get_header(); ?>


<div id="content" class="widecolumn">

 <?php if (have_posts()) : while (have_posts()) : the_post();?>
 <div class="post">
    <h2 id="post-<?php the_ID(); ?>"><?php the_title();?></h2>
    <div class="entrytext">
        <?php the_content(); ?>
    </div>
 </div>
 <?php endwhile; endif; ?>
 <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>

</div>

//this will include the theme footer.php file
<?php get_footer(); ?>
share|improve this answer
    
darn, should have mentioned ... I tried precisely this content (from the codex) before I posted here and got the same results :-) in either case, even if it was empty, I would expect an empty screen, not the entire contents of the front page ;-) –  Joel Martinez May 11 '11 at 13:00
    
what custom query - if any - are using before the loop in your page template? –  Michael May 11 '11 at 17:13
    
none ... whether I use the above mentioned script, or just a blank "template name", it renders the whole front page –  Joel Martinez May 11 '11 at 17:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.