本文使用「署名 4.0 国际 (CC BY 4.0)」许可协议,欢迎转载、或重新修改使用,但需要注明来源。 [署名 4.0 国际 (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/deed.zh) 本文作者: 苏洋 创建时间: 2009年07月05日 统计字数: 1102字 阅读时间: 3分钟阅读 本文链接: https://soulteary.com/2009/07/05/phpwordpress%E9%A2%84%E5%8F%91%E5%B8%83%E9%A2%84%E5%91%8A%E7%AE%80%E5%8D%95%E5%AE%9E%E7%8E%B0.html ----- # [PHP]WordPress预发布预告简单实现 最近生病&有点忙,便没有更新,闲的时候想起来MG有展示过一个预发布状态...[为了不抢MG的生意,我没做成插件,其实稍微了解PHP语法的朋友,稍加修改可以做成带有定制标题,时间显示,文章标题修饰的插件...] 使用方法:在任意WP PHP主题脚本中使用fir_recent_future()即可,效果如下: [![预发布预告预览](https://attachment.soulteary.com/2009/07/05/2009-07-05_105046.png "预发布预告预览")](https://attachment.soulteary.com/2009/07/05/2009-07-05_105046.png) ```php 'post', 'post_status' => 'future', 'posts_per_page' => 5, 'orderby' => 'post_date', 'order' => 'ASC' ) ); $futures =& $futures_query->posts; } if ( $futures && is_array( $futures ) ) { $list = array(); foreach ( $futures as $future ) { $url = get_edit_post_link( $future->ID ); $post_id=$future->ID; $title = get_the_title($post_id); if (empty($title)) { $title = __('(未命名)'); } $item = '

'.$title.''.get_the_time(__('Y/m/d g:i:s A'), $future).'

'; if ( $the_content = preg_split( '#\s#', strip_tags( $future->post_content ), 11, PREG_SPLIT_NO_EMPTY ) ) $item .= '

' . join( ' ', array_slice( $the_content, 0, 10 ) ) . ( 10 < count( $the_content ) ? '…' : '' ) . '

'; $list[] = $item; } ?>
```