编程开发
$_G[siteurl]
在模板文件需要打印数组的地方加以下代码: <!--{eval print_r($_G);}--> 请把$_G替换成你要打印的数组变量
1、批量修改文章标题: UPDATE wp_posts SET post_title= replace( post_title, '老的', '新的' ); 1、批量修改文章内容: UPDATE wp_posts SET post_content = replace( post_content, '老的', '新的' ); 2、批量修改文章摘要: UPDATE wp_p
第一种:修改CSS文件,添加以下代码 html{ -webkit-filter: grayscale(100%); /* webkit */ -moz-filter: grayscale(100%); /*firefox*/ -ms-filter: grayscale(100%); /*ie9*/ -o-filter: grayscale(100%); /*opera*
把下面这段代码放到 functions.php 内即可 //上传图片重新命名 add_filter('wp_handle_upload_prefilter', function($file){ $str = substr(str_shuffle('abcdefghijklmnopqrstuvwxyz1234567890'),0,6); $file['name'] = s
把下面这段代码放到 functions.php 内即可 add_filter( 'wp_unique_post_slug', 'wmou_unique_post_slug', 10, 6 ); function wmou_unique_post_slug( $post_ID ) { $new_slug = md5($post_ID); return $new_slug;
//搜索过滤,仅搜索post文章 function SearchFilter($query){ //仅搜索时 if($query->is_search){ //设定指定的文章类型,这里仅搜索文章 $query->set('post_type',array('post')); //指定文章和自定义类型 //$query->set('post_type', array('p
//生成随机六位数,不足六位两边补零 str_pad(mt_rand(0, 999999), 6, "0", STR_PAD_BOTH);
$(document).ready(function(){ interval = setInterval(checkPayStatus,2000);//每2秒执行一次checkIsExist方法 }); function checkPayStatus(){ $.ajax({ url: "", data: { action: "status", }, dataType:
function filter_pre_get_posts( $query ){ if ( $query->is_main_query() ){ $num = ''; if ( is_category(array(2)) ){ $num = 20; }//例如分类ID为2的显示20篇 if ( '' != $num ){ $query->set( 'posts_per_