Php Wordpress在静态页面中显示最近发布的博客
在WordPress中,我正在显示一个静态首页,其中Php Wordpress在静态页面中显示最近发布的博客,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,在WordPress中,我正在显示一个静态首页,其中阅读面板中的首页显示设置为。这很好,但我想在这个静态页面中显示最近的博客文章列表。我不确定在这个静态页面中显示最近的博客文章的最佳方法是什么。那么,有人能指导我在静态页面中显示最近的博客吗?任何帮助和建议都是值得欣赏的。在您想要显示博客内容的地方尝试这段代码 <div class="blog-post-wrap"> <?php $args = array( 'numberposts' => '4' ); $r
阅读面板中的首页显示设置为。这很好,但我想在这个静态页面中显示最近的博客文章列表。我不确定在这个静态页面中显示最近的博客文章的最佳方法是什么。那么,有人能指导我在静态页面中显示最近的博客吗?任何帮助和建议都是值得欣赏的。在您想要显示博客内容的地方尝试这段代码
<div class="blog-post-wrap">
<?php
$args = array( 'numberposts' => '4' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){?>
<div class="blog"><?php echo substr($recent["post_content"], 0 , 150); ?>
<span class="link"><?php echo '<a href="' . get_permalink($recent["ID"]) . '" title="Reaed More '.$recent["post_title"].'" >' . 'Read More'.'</a> '; ?></span>
</blog>
<?php } ?>
</div>
我使用了
一段代码在页面上显示有限的字符。你可以根据自己的要求改变 您只需使用iframe包装查询,并将iframe放置在任何html或php页面上,而无需触摸当前页面代码。。。。请参阅此链接的详细说明: