多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
``` /** * Supercool snippet of WPEngineer to inform your users that you will close the comments in xdays * The function calculates the difference between today and how many days there are left. * * @source: //wpengineer.com/2692/inform-user-about-automatic-comment-closing-time/ */ add_action( 'comment_form_top', 'so_topic_closes_in' ); function so_topic_closes_in() { global $post; if ( $post->comment_status == 'open' ) { $close_comments_days_old = get_option( 'close_comments_days_old' ); $expires = strtotime( "{$post->post_date_gmt} GMT" ) + $close_comments_days_old * DAY_IN_SECONDS; printf( __( '(This topic will automatically close in %s. )', 'textdomain' ), human_time_diff( $expires ) ); } } ```