功能实现起来很简单,用PHP编辑器打开当前模版的 functions.php文件。
复制代码
代码如下:
function is_old_post($post_id=null){$days = 15;global $wp_query;if(is_single() || is_page()) {if(!$post_id) {$post_id = $wp_query->post->ID;}$current_date = time();$offset = $days *60*60*24;$post_id = get_post($post_id);$post_date = mysql2date('U',$post_id->post_date);$cunning_math = $post_date + $offset;$test = $current_date - $cunning_math;if($test > 0){$return = true;}else{$return = false;}}else{$return = false;}return $return;}
打开 single.php文件,把以下代码复制进去:
复制代码
代码如下:
< ?php if(is_old_post()){ ?>insert AD CODE HERE< ?php } ?>














发表评论