Wordpress查询从文章/页面中提取片段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress查询从文章/页面中提取片段相关的知识,希望对你有一定的参考价值。

This simply pulls 165 characters from a page/post. Important to reset the query.
  1. <?php query_posts('pagename=about'); ?>
  2. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  3. <div><h4>Type your title here</h4>
  4. <p><?php echo substr(strip_tags($post->post_content), 0, 165); ?>... <a href="<?php bloginfo('url'); ?>/about">Read More</a></p></div>
  5. <?php endwhile; endif;
  6. //Reset Query
  7. wp_reset_query();
  8. ?>

以上是关于Wordpress查询从文章/页面中提取片段的主要内容,如果未能解决你的问题,请参考以下文章