html - 如何在 Wordpress 循环外显示最新帖子?

标签 html css wordpress loops post

如何在 Wordpress 的循环外显示和创建带有最新帖子的框?我在这个链接的图片上展示了这个http://i.imgur.com/UbBvlnE.png .我在红框中谈论这个 ;) 对不起我的英语。

我在主页上的所有帖子都使用 Masonry CSS http://sickdesigner.com/masonry-css-getting-awesome-with-css3/

这是循环的代码:

<div class="all_center">
<?php query_posts($query_string."&orderby=post_date"); ?>
        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <div <?php post_class() ?> id="post-<?php the_ID(); ?>">

                        <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>


<?php the_post_thumbnail('mediumImageCropped'); ?>
                        <div class="entry">
                        <?php the_excerpt(); ?>
<div class="postmetadata">


                        </div>
</div>
</div>


        <?php endwhile; ?>



        <?php else : ?>

                <h2>Not Found</h2>

        <?php endif; ?>

</div>

最佳答案

$recent_posts = wp_get_recent_posts( array( 'numberposts' => '1' ) );

echo get_the_post_thumbnail($recent_posts[0]['ID'], 'thumbnail'); 

echo $recent_posts[0]['post_content'];

关于html - 如何在 Wordpress 循环外显示最新帖子?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18283298/

相关文章:

html - 将子菜单与主菜单对齐

css - 无法让列表项水平排列

wordpress - 得到通知是 wordpress "WP_Scripts::localize was called incorrectly"

javascript - 仅当 Javascript 在视口(viewport)中时才执行

wordpress - 显示每个类别中的帖子数 - wordpress

jquery - 如何使用 html5 css 和 jquery 创建这个特殊的加载器?

html - 3张图片作为div的背景

javascript - 停留在简单的 Ember.js 示例上,我认为我的 javascript 文件没有被使用

javascript - 带有切换功能的 jQuery 悬停功能不起作用

javascript - Bootstrap,如何在使用视口(viewport)高度时向下滚动后使导航栏变粘?