You forgot to create “theloop” for the page template.
If I remember correctly, the_content()
only works inside the loop.
the_content would work…..with the rest of the loop
http://codex.wordpress.org/The_Loop
http://codex.wordpress.org/The_Loop_in_Action
you gotta tell WP to load posts at very least…… some kind of query
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
etc…..
hmm thanks for the heads up.
Is there a way to start a look without looking for posts?
There are not any posts on this website… and without posts it just continues to look for them.
I tried running and if loop with no success:( The if loop executes, but it doesn’t load the content still…
<?php get_header();?>
<?php include (TEMPLATEPATH . '/sbdaytrips.php');?>
<?php if(have_posts()) :?>
<div class="post">
<div class="entry">
<?php the_content(); ?>
</div>
</div>
<?php endif; ?>
<?php get_footer(); ?>
It seems kinda sloppy to have to run an if loop just to do this, does anyone else have a better idea?
the best bet would be to model the template after page.php
you still have an incomplete loop…..
<?php if(have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
but if you are just trying to have a special page specific sidebar show up on a certain page, I believe you could just edit your page.php with a conditional statement to load the special sidebar for a specific page.
http://codex.wordpress.org/Conditional_Tags
<?php get_header(); ?>
<?php include (TEMPLATEPATH . ‘/sbdaytrips.php’); ?>
<?php //loop to get content
if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile(); ?>
<?php get_footer(); ?>
That said, you can create a custom field with text content to display IF it exists in or outside of the loop.
For example, using c2c’s excellent get custom plugin, you can add a custom field to the desired page (let’s call the key “default-text”) and call that from your custom page template outside of the loop with the plugin’s c2c_get_recent_custom(‘default-text’); function. But of course, that means the text will display for every page that uses your custom template, which is great if you have a common element for all pages.
Within the loop however, you can call SPECIFIC text (default-text) for the current page only IF the custom field ‘default-text’ exists for that page using c2c_get_custom(‘default-text’);
It will only display the specific text WHEN and IF that field exists for THAT page.
You can read about the plugin here:
http://coffee2code.com/wp-plugins/get-custom-field-values/
It’s the one of my MUST-USE plugins for every site done as a CMS
@syncbox
few corrections to your code, there is also a simpler way to write it:
<?php get_header(); ?>
<?php include (TEMPLATEPATH . '/sbdaytrips.php'); ?>
//begin loop
<?php if (have_posts()) : while (have_posts()) : the_post();?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<?php get_footer(); ?>