2012-12-05 10:10
浏览 63


In WordPress I am displaying a static front page with the Front page displays setting in the Reading panel. This is working good but I would like to show a list of recent blog posts into this static page.I am not sure what will be the best method to show the recent blog posts in this static page. So can someone please guide me to show the recent blogs in the static page? Any help and suggestions will be appreciable.

图片转代码服务由CSDN问答提供 功能建议

在WordPress中我显示的是静态首页,其中首页显示设置 阅读面板。 这很好,但我想在这个静态页面中显示最近的博客文章列表。我不确定在这个静态页面中显示最近博客文章的最佳方法是什么。 那么有人可以指导我在静态页面中显示最近的博客吗? 任何帮助和建议都会很明显。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanlv1366 2012-12-05 10:41

    Try this piece of code where you want to show the blog content

    <div class="blog-post-wrap">
      $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>
      <?php } ?>

    I have used <?php echo substr($recent["post_content"], 0 , 150); ?> piece of code to show limited characters on the page. You can change that as your requirement.

    打赏 评论
  • dsz7121 2013-11-25 11:38

    You can simply use an iframe to wrap your query and place the iframe on any html or php page without having to touch your current page code.... See detail explanation on this link: http://allnigeriansinspain.com/blog/show-wordpress-post-on-static-html-page/

    打赏 评论

相关推荐 更多相似问题