我已经看到一些网站显示了更新后的帖子。如何从数据库查询更新后的帖子。
请帮帮我
谢谢
我已经看到一些网站显示了更新后的帖子。如何从数据库查询更新后的帖子。
请帮帮我
谢谢
您可以从以下位置使用此查询perishablepress.com 获取后期修订。
<?php
$today = current_time(\'mysql\', 1);
$number = 5; // number of posts
if($recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = \'publish\' AND post_modified_gmt < \'$today\' ORDER BY post_modified_gmt DESC LIMIT $number")):
?>
<h2><?php _e(\'Recently Updated\'); ?></h2>
<ul>
<?php
foreach($recentposts as $post) {
if($post->post_title == \'\') $post->post_title = sprintf(__(\'Post #%s\'), $post->ID);
echo \'<li><a href="\'.get_permalink($post->ID).\'">\'.the_title().\'</a></li>\';
} ?>
</ul>
<?php endif; ?>
这将根据post_modified_gmt
一个帖子的时间,然后还根据post_modified_gmt
嗨,我目前正在为我的博客构建一个主题。下面的代码指向最新的帖子(特色帖子)。因为这将有一个不同的风格比所有其他职位。然而我想过滤掉帖子格式:链接使用我在循环中定义的WP查询,因为它给我带来了更多的灵活性。我该怎么做呢? <?php $featured = new WP_Query(); $featured->query(\'showposts=1\'); ?> <?php while ($featured->have_post