I have a problem with page.php templates and loading page content.
- I wanted an About page so I created a page.php template, using the default theme and the documentation as a guide. I created the About page in the 'pages' section of the WP admin console.
- I would have expected that I needed to assign the page.php template to the About page. Strangely, the page.php template I created does not show up in the template drop down in the Quick Edit page. I don't know why and this worried me.
- Despite this, when I use the preview function in the pages admin area, the page generates fine using the page.php template, and looks just the way it should. I thought the WP somehow was smart enough to 'find' the page.php template anyway.
- I published the about page last night. When I checked the website real-time, again the page generated just fine.
- Then this morning I checked my website and the About page content was no longer appearing on the page. However, parts of the page.php generated OK. The sidebars and the footer showed up. But the content was not. Now, if the page.php template didn't appear at all, I would assume the problem had to be the template assignment. But it seems like WP is still finding the page.php template because it is partially generated.
- I recreated the page.php to see if that would provoke page.php to show up in the templates drop down. It didn't.
- I deleted and then recreated the About page content to provoke some kind of reaction. There was none.
- So I added HTML to the template file to test where the problem happens. WP is definitely finding the template because the HTML I inserted at the top of the file appears. It seemed like there is maybe a problem in the loop...? Maybe I am missing some statements? I provided the code from my loop. Can someone tell me what is wrong? (Note: I omitted comments on purpose.)
- It still may be that the assignment is the root of the problem, but if the page.php does not show up in the drop down, what can I do? It seems like it is a UI bug in the admin console or something.
Thanks for the help.
<p> Testing to see if this template is being called. Yes, this text appears.</p>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:0px;">
<?php the_title(); ?></h1>
<?php the_content(__('(more...)')); ?>
<?php endwhile; else: ?>
<?php endif; ?>