[英]Wordpress show recent post blogs in static page
在WordPress中,我正在顯示一個靜態首頁,其中“ Reading
面板中的“ Front page displays
設置。 這很好,但我想在這個靜態頁面中顯示最近的博客文章列表。我不確定在這個靜態頁面中顯示最近博客文章的最佳方法是什么。 那么有人可以指導我在靜態頁面中顯示最近的博客嗎? 任何幫助和建議都會很明顯。
嘗試使用這段代碼來顯示博客內容
<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>
我用<?php echo substr($recent["post_content"], 0 , 150); ?>
<?php echo substr($recent["post_content"], 0 , 150); ?>
一段代碼在頁面上顯示有限的字符。 您可以根據自己的要求進行更改。
您可以簡單地使用iframe來包裝您的查詢並將iframe放在任何html或php頁面上,而無需觸摸您當前的頁面代碼....請參閱此鏈接的詳細說明: http : //allnigeriansinspain.com/blog/show -wordpress-后上靜態HTML頁/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.