简介: 这是主题中的一个对话框插件,主要包含两个文件,dialog.js 和 dialog.css 。 https://gitee.com/vthemecn/miragev/blob/main/assets/css/src/common/dialog.css https://gitee.com/vthemecn/miragev/blob/main/assets/js/src/dialog.js & […]
WordPress 使用的经典编辑器是 TinyMCE,默认情况下,WordPress 自带的编辑器并没有包含 codesample 插件,如果使用下列代码: 会提示找不到插件路径: 解决办法如下:
/* 加载页面模板 */ add_filter( 'page_template', 'marker_page_template' ); function marker_page_template( $page_template ) { if ( get_page_template_slug() == 'markerv' ) { $page_template = MARKER_DIR . '/tem […]
一,常用函数 获取当前用户ID的方式: 通过邮箱获取用户信息的方式: 通过ID获取用户信息的方式: 二,WP_User 类 通过 WP_User 类获取用户信息 方法: 用户信息:
简介 WordPress v4.4以后,已经内置了WP REST API。 接口文档:https://developer.wordpress.org/rest-api/ The WordPress REST API provides an interface for applications to interact with your WordPress site by sending and r […]
1,数据库相关表 WordPress 文章表中是没有文章点击次数这个字段的,所以把文章点击次数,保存在表 wp_postmeta 中。 2, 通用函数 /** * 设置文章浏览次数 */ function setPostViews($postID) { $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_k […]
什么是 WordPress 插件 ? 插件( Plugins )是如何与 WordPress 交互的 WordPress 为插件提供了多种丰富的 APIs。每一种 API( 应用程序接口 )使插件和 WordPress 以不同的方式交互。下面是 WordPress 提供的主要 APIs 以及他们的功能列表: 插件: 给插件提供一系列的钩子( hooks )来使用 WordPress 的相关部分。W […]
WordPress 一共有以下12个表,默认表前缀是 “wp_” wp_commentmeta 存储评论的元数据 meta_id:自增唯一ID comment_id:对应评论ID meta_key:键名 meta_value:键值 wp_comments 存储评论 comment_ID:自增唯一ID comment_post_ID:对应文章ID comment_author […]
WordPress 循环读取文章数据的方法一般使用 query_posts(),但是 query_posts() 这个函数有一些缺点,可能会干扰那些用到的Loop(循环)的插件。可能使一些 WordPress 条件标签失效。这时候最好的选择就是使用 WP_Query 类了。 用法: 参数详解:
WordPress 自带的 RESTful API 内置的身份验证方法是 Cookie Authentication ,登录仪表板时,会生成cookie。为了防止CSRF,需要在请求的地址后面,加上一个 nonce 参数“_wpnonce”。 CSRF请参考:https://javascript.net.cn/article?id=683 nonce生成,参考:https://verytheme. […]
1, bloginfo(‘template_url’) http://localhost/wordpress/wp-content/themes/mytheme 2, bloginfo(‘template_directory’) http://localhost/wordpress/wp-content/themes/mytheme 3, get_t […]
图片列表
热门文章
-
搜索引擎提交入口2年前 (2023-06-26)
-
WordPress 的用户角色和权限2年前 (2023-06-28)
-
WP_REST_Response 返回结果类2年前 (2023-07-25)
-
WordPress 使用 tag 标签获取文章列表的方法2年前 (2023-06-18)