我正在使用wordpress 3.2,我做了一个如下的查询帖子:
<?php query_posts("posts_per_page=1post=type&page=post_parent=10");?>
然后我试着重复我这样询问的这篇文章的日期。<?php echo the_date(); ?>
它给了我这篇文章的标题、摘录和永久链接,但没有日期。你认为问题是什么。我肯定这是件很尴尬的事。以下是我的视频页面模板文件中的代码:
<?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="<?php echo the_permalink(); ?>" class="more2">Watch Now</a></p>
在这里,我尝试将查询放入循环中:<?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="<?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; ?>
\\u date()不起作用,但\\u title()和其他函数起作用。顺便说一下,这将我的查询更改为\\u post(),这不是我想要的。我想查询最新的视频,就像我在循环上面做的那样。顺便说一句,我在页面的前面使用了\\u date函数,它起到了作用。这可能是问题所在吗?这是我遇到问题的代码之前的代码。
<div id="col75" class="firstcol">
<iframe id="video" src="http://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>