I am using wordpress 3.2 and I did a query post like this:
<?php query_posts("posts_per_page=1post=type&page=post_parent=10");?>
Then I try to echo out the date of this post I queried like this.
<?php echo the_date(); ?>
It gives me the title of the post and the excerpt and the permalink but no date. What do you think the problem is. I’m sure it’s something quite embarrassing.
Here is the code in my template file for the video page:
<?php query_posts("posts_per_page=1post=type&page=post_parent=10");?>
<h2>Recent Video</h2>
<h3 class="date"><?php echo the_date(); ?></h3>
<p><strong><?php echo the_title(); ?></strong><?php echo the_excerpt(); ?></p>
<p><a href="https://wordpress.stackexchange.com/questions/52489/<?php echo the_permalink(); ?>" class="more2">Watch Now</a></p>
Here I try to put the query in a loop:
<?php query_posts("posts_per_page=1post=type&page=post_parent=10");?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2>Recent Video</h2>
<h3 class="date"><?php echo the_date(); ?></h3>
<p><strong><?php echo the_title(); ?></strong><?php echo the_excerpt(); ?></p>
<p><a href="https://wordpress.stackexchange.com/questions/52489/<?php echo the_permalink(); ?>" class="more2">Watch Now</a></p>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
the_date() did not work but the the_title() and other functions worked. By the way this changed my query to the_post() which is not what I’m wanting. I want to query the latest video like I did above the loop.
By the way I used the_date function earlier in the page and it worked. Could that be the problem? Here is it before the code that I had a problem with.
<div id="col75" class="firstcol">
<iframe id="video" src="https://www.youtube.com/embed/videoseries?list=<?php print get_post_meta($post->ID,"playlist_id", true); ?>" width="560" height="350" frameborder="0"></iframe>
<div id="col25">
<h2><?php echo get_post_meta($post->ID,"speaker", true); ?></h2>
<h3 class="date"><?php echo the_date(); ?></h3>