[pcsh lang="php" tab_size="4" message="" hl_lines="" provider="manual"]/** * 获取WordPress所有分类名字和ID */ function show_category(){ global $wpdb; $request = "SELECT $wpdb->terms.te...
[pcsh lang="php" tab_size="4" message="" hl_lines="" provider="manual"]/** * 获取WordPress所有分类名字和ID */ function show_category(){ global $wpdb; $request = "SELECT $wpdb->terms.te...
原文地址:http://codex.wordpress.org/zh-cn:Class_Reference/wpdb使用wordpress的时候,如果想直接使用WP里封装的数据库操作的类(wp-db.php),将wp-blog-header.php包含到代码中就可以使用了。[pcsh lang="php" tab_size="4" message="" hl_lines="" provide...
今天很奇怪。。中间有个地方确实写错了。。title和内容没有转码调用了wp_insert_post函数,结果无论如何都插不进转码之后才解决了,真奇怪[pcsh lang="php" tab_size="4" message="" hl_lines="" provider="manual"]$title[1][0] = iconv('gbk','utf-8...
preg_replace — 执行一个正则表达式的搜索和替换mixed preg_replace ( mixed $pattern , mixed $replacement , mixed $subject [, int $limit= -1 [, int &$count ]] )搜索subject中匹配pattern的部分, 以replacement进行替换。参数pattern要搜...
应该使用s模式也就是最后加个s例如:[pcsh lang="js" tab_size="4" message="" hl_lines="" provider="manual"]/\<font face\=\"Arial\"\>(.*?)\<\/font\>/s[/pcsh]
钩子被储存在 $wp_filter 全局变量里,所以,要获取钩子列表,可以直接获取 $wp_filter 全局变量。[pcsh lang="php" tab_size="4" message="" hl_lines="" provider="manual"]var_dump( $GLOBALS[‘wp_filter’] );[/pcsh]
经过实验,最好使用add_meta_boxes钩子,[pcsh lang="php" tab_size="4" message="" hl_lines="" provider="manual"]add_action('add_meta_boxes', 'addMetaBox'); // 增加 后台meta面板[/pcsh]使用这个钩子时可以获得文章信息...
描述引入当前主题的页脚文件 footer.php,如果使用特定的名字,那么就会调用这个特定名字的页脚文件 footer-{name}.php 。如果主题没有 footer.php 就会引入默认的 wp-includes/theme-compat/footer.php 。用法<?php get_footer( $name ); ?>参数$name(string) (可选) 调用 f...
该函数可在数据库中插入文章(及页面)。它可以进行处理变量,检查操作,填充日期/时间等缺失变量等工作。该函数以对象作为变量,返回已创建文章的编号(出错时返回0)。用法<?php wp_insert_post( $post, $wp_error ); ?>参数 $post (array) (必需) 一个文章对象. 与数据库wp_posts表中的字段一一对应默认: 无 重要: 如果设置...