Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ijianbo
rest Api To Miniprogram
提交
2f6fb496
rest Api To Miniprogram
项目概览
ijianbo
/
rest Api To Miniprogram
通知
22
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
rest Api To Miniprogram
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
2f6fb496
编写于
9月 15, 2020
作者:
J
jianbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、在文章和分类列表显示id值
2、编辑分类页面的封面图,提供上传图片按钮选择媒体 3、插件设置里提供上传图片按钮选择媒体
上级
c88b304d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
86 addition
and
9 deletion
+86
-9
includes/filter/ram-custom-category-rows.php
includes/filter/ram-custom-category-rows.php
+19
-0
includes/filter/ram-custom-category.php
includes/filter/ram-custom-category.php
+11
-5
includes/filter/ram-custom-posts-rows.php
includes/filter/ram-custom-posts-rows.php
+15
-0
includes/js/script.js
includes/js/script.js
+25
-0
includes/settings/wp-wechat-config.php
includes/settings/wp-wechat-config.php
+5
-2
rest-api-to-miniprogram.php
rest-api-to-miniprogram.php
+11
-2
未找到文件。
includes/filter/ram-custom-category-rows.php
0 → 100644
浏览文件 @
2f6fb496
<?php
//禁止直接访问
if
(
!
defined
(
'ABSPATH'
)
)
exit
;
function
ram_custom_taxonomy_columns
(
$columns
)
{
$columns
[
'id'
]
=
__
(
'id'
);
return
$columns
;
}
function
ram_custom_taxonomy_columns_content
(
$content
,
$column_name
,
$term_id
)
{
if
(
$column_name
==
"id"
){
echo
$term_id
;
}
}
\ No newline at end of file
includes/filter/ram-custom-category.php
浏览文件 @
2f6fb496
...
...
@@ -72,18 +72,22 @@ function getSubscription($openid)
add_action
(
'category_add_form_fields'
,
'weixin_new_term_catcover_field'
);
function
weixin_new_term_catcover_field
()
{
wp_nonce_field
(
basename
(
__FILE__
),
'weixin_app_term_catcover_nonce'
);
?>
wp_nonce_field
(
basename
(
__FILE__
),
'weixin_app_term_catcover_nonce'
);
?>
<div
class=
"form-field weixin-app-term-catcover-wrap"
>
<
!-- <
div class="form-field weixin-app-term-catcover-wrap">
<label for="weixin-app-term-catcover">微信小程序封面</label>
<input type="url" name="weixin_app_term_catcover" id="weixin-app-term-catcover" class="type-image regular-text" data-default-catcover="" />
</div>
<?php
}
</div> -->
<?php
}
add_action
(
'category_edit_form_fields'
,
'weixin_edit_term_catcover_field'
);
function
weixin_edit_term_catcover_field
(
$term
)
{
$default
=
''
;
$catcover
=
get_term_meta
(
$term
->
term_id
,
'catcover'
,
true
);
wp_enqueue_script
(
'rawscript'
,
plugins_url
()
.
'/'
.
REST_API_TO_MINIPROGRAM_PLUGIN_NAME
.
'/includes/js/script.js'
,
false
,
'1.0'
);
if
(
!
$catcover
)
$catcover
=
$default
;
?>
...
...
@@ -92,10 +96,12 @@ function weixin_edit_term_catcover_field( $term ) {
<td>
<?php
echo
wp_nonce_field
(
basename
(
__FILE__
),
'weixin_app_term_catcover_nonce'
);
?>
<input
type=
"url"
name=
"weixin_app_term_catcover"
id=
"weixin-app-term-catcover"
class=
"type-image regular-text"
value=
"
<?php
echo
esc_attr
(
$catcover
);
?>
"
data-default-catcover=
"
<?php
echo
esc_attr
(
$default
);
?>
"
/>
<input
id=
"weixin_app_term_catcover-btn"
class=
"button im-upload"
type=
"button"
value=
"选择图片"
/>
</td>
</tr>
<?php
}
add_action
(
'create_category'
,
'weixin_app_save_term_catcover'
);
add_action
(
'edit_category'
,
'weixin_app_save_term_catcover'
);
...
...
includes/filter/ram-custom-posts-rows.php
0 → 100644
浏览文件 @
2f6fb496
<?php
//禁止直接访问
if
(
!
defined
(
'ABSPATH'
)
)
exit
;
function
ram_posts_columns
(
$columns
)
{
$columns
[
'id'
]
=
__
(
'id'
);
return
$columns
;
}
function
output_ram_posts_custom_columns
(
$column
,
$post_id
)
{
echo
$post_id
;
}
includes/js/script.js
0 → 100644
浏览文件 @
2f6fb496
jQuery
(
document
).
ready
(
function
(
$
)
{
//选择媒体库
$
(
'
body
'
).
on
(
"
click
"
,
'
.im-upload
'
,
function
(
e
)
{
e
.
preventDefault
();
// 阻止事件默认行为。
var
upload
=
$
(
this
).
prev
(
"
input
"
);
var
type
=
$
(
this
).
data
(
'
type
'
);
var
title
=
(
type
==
'
image
'
)?
'
选择图片
'
:
'
选择媒体
'
;
uploader
=
wp
.
media
({
title
:
title
,
library
:
{
type
:
type
},
button
:
{
text
:
title
},
multiple
:
false
}).
on
(
'
select
'
,
function
()
{
var
attachment
=
uploader
.
state
().
get
(
'
selection
'
).
first
().
toJSON
();
upload
.
val
(
attachment
.
url
);
$
(
'
.media-modal-close
'
).
trigger
(
'
click
'
);
}).
open
();
return
false
;
});
})
\ No newline at end of file
includes/settings/wp-wechat-config.php
浏览文件 @
2f6fb496
...
...
@@ -15,7 +15,9 @@ function get_jquery_source() {
$url
=
plugins_url
(
''
,
__FILE__
);
wp_enqueue_style
(
"tabs"
,
plugins_url
()
.
"/rest-api-to-miniprogram/includes/js/tab/tabs.css"
,
false
,
"1.0"
,
"all"
);
wp_enqueue_script
(
"tabs"
,
plugins_url
()
.
"/rest-api-to-miniprogram/includes/js/tab/tabs.min.js"
,
false
,
"1.0"
);
}
wp_enqueue_script
(
'rawscript'
,
plugins_url
()
.
'/'
.
REST_API_TO_MINIPROGRAM_PLUGIN_NAME
.
'/includes/js/script.js'
,
false
,
'1.0'
);
}
function
register_weixinappsettings
()
{
// 注册设置
...
...
@@ -186,7 +188,8 @@ if (version_compare(PHP_VERSION, '5.6.0', '<=') )
<tr
valign=
"top"
>
<th
scope=
"row"
>
海报图片默认地址
</th>
<td><input
type=
"text"
name=
"wf_poster_imageurl"
style=
"width:400px; height:40px"
value=
"
<?php
echo
esc_attr
(
get_option
(
'wf_poster_imageurl'
)
);
?>
"
/><br/><p
style=
"color: #959595; display:inline"
>
* 请输完整的图片地址,例如:https://www.watch-life.net/images/poster.jpg
</p></td>
<td><input
type=
"text"
name=
"wf_poster_imageurl"
style=
"width:400px; height:40px"
value=
"
<?php
echo
esc_attr
(
get_option
(
'wf_poster_imageurl'
)
);
?>
"
/>
<input
id=
"wf_poster_imageurl-btn"
class=
"button im-upload"
type=
"button"
value=
"选择图片"
/><br/><p
style=
"color: #959595; display:inline"
>
* 请输完整的图片地址,例如:https://www.watch-life.net/images/poster.jpg
</p></td>
</tr>
<tr
valign=
"top"
>
...
...
rest-api-to-miniprogram.php
浏览文件 @
2f6fb496
...
...
@@ -3,7 +3,7 @@
Plugin Name: REST API TO MiniProgram
Plugin URI: http://www.watch-life.net
Description: 为微信小程序、app提供定制化WordPress REST API json 输出.
Version: 1.6.
3
Version: 1.6.
5
Author: jianbo
Author URI: http://www.minapper.com
License: GPL v3
...
...
@@ -26,7 +26,8 @@ include(REST_API_TO_MINIPROGRAM_PLUGIN_DIR . 'includes/filter/ram-custom-content
include
(
REST_API_TO_MINIPROGRAM_PLUGIN_DIR
.
'includes/filter/ram-custom-post-fields.php'
);
include
(
REST_API_TO_MINIPROGRAM_PLUGIN_DIR
.
'includes/filter/ram-custom-category.php'
);
include
(
REST_API_TO_MINIPROGRAM_PLUGIN_DIR
.
'includes/filter/ram-custom-users-columns.php'
);
include
(
REST_API_TO_MINIPROGRAM_PLUGIN_DIR
.
'includes/filter/ram-custom-category-rows.php'
);
include
(
REST_API_TO_MINIPROGRAM_PLUGIN_DIR
.
'includes/filter/ram-custom-posts-rows.php'
);
if
(
!
class_exists
(
'RestAPIMiniProgram'
)
)
{
class
RestAPIMiniProgram
{
...
...
@@ -47,7 +48,15 @@ if ( ! class_exists( 'RestAPIMiniProgram' ) ) {
//给TinyMCE编辑器增加A标签按钮
add_action
(
'after_wp_tiny_mce'
,
'add_tinyMCE_minapper_button'
);
//文章页显示自定义列
add_filter
(
'manage_posts_columns'
,
'ram_posts_columns'
);
add_action
(
'manage_posts_custom_column'
,
'output_ram_posts_custom_columns'
,
10
,
3
);
//分类目录页自定义列
add_filter
(
'manage_edit-category_columns'
,
'ram_custom_taxonomy_columns'
);
add_filter
(
'manage_category_custom_column'
,
'ram_custom_taxonomy_columns_content'
,
10
,
3
);
//更新浏览次数(pc)
add_action
(
'wp_head'
,
'addPostPageviews'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录