Skip to content

Commit f733f8f

Browse files
committed
20210822
修复网址编辑时删除图标按钮失效 修复部分错误 增加网址分类快速添加图标的方法(更新后需按照新方法重新添加图标) 修改网址块简介为显示一行,且优化块布局 更换二维码api 更换自动网址图标 api
1 parent 4ec7db0 commit f733f8f

27 files changed

+462
-301
lines changed

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# WebStack
2-
WordPress 版 WebStack 主题
2+
WordPress 版 WebStack 主题。<a href="http://webstack.iotheme.cn/">前往演示站</a>
33
<br/>
44

55
### 首页截图
66
<br/>
77

8-
![Thumbnail_index](https://res.iowen.cn/wp-content/uploads/2019/08/iowen_2019-08-27_01-05-39.png)
8+
![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/01.png)
99
<br/>
1010

1111
### 环境要求
@@ -16,7 +16,7 @@ WordPress 版 WebStack 主题
1616

1717
### 安装指南
1818
+ 安装 WordPress ,教程百度
19-
+ 设置伪静态
19+
+ 设置伪静态(下方规则按自己服务器环境二选一)
2020
```
2121
# Nginx规则
2222
location /
@@ -46,19 +46,21 @@ RewriteRule . /index.php [L]
4646
+ 分类最多两级,且父级不要添加内容
4747
+ 可以不添加网址图片,主题会自动获取目标网址的 favicon 图标
4848
+ 导航菜单栏标题前面的图标请在分类图像描述中填入(参考下图),图标样式请参考fontawesome
49-
![Thumbnail_index](https://res.iowen.cn/wp-content/uploads/2019/08/Snipaste_2019-08-30_13-43-06.png)
49+
![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/02.png)
50+
+ 增加分类快速添加图标的方法
51+
![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/07.png)
5052
+ 导航菜单栏下方可以添加自定义菜单,在后台的外观-->菜单里设置,在菜单的css类添加图标(参考下图),图标样式请参考fontawesome
51-
![Thumbnail_index](https://res.iowen.cn/wp-content/uploads/2019/08/Snipaste_2019-08-30_13-50-59.png)
53+
![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/03.png)
5254
+ 如果菜单里没有css类,请按下图添加
53-
![Thumbnail_index](https://res.iowen.cn/wp-content/uploads/2019/11/iowen_20191120_160814.jpg)
54-
+ <a href="https://www.iowen.cn/webstack-pro-navigation-theme-advanced/" target="_blank">如果你有更多功能需求,点我-></a>
55+
![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/04.jpg)
56+
+ <a href="https://www.iotheme.cn/store/onenav.html" target="_blank">如果你有更多功能需求,点我-></a>
5557
<br/>
5658

5759
### 后台截图
5860
<br/>
5961

60-
![Thumbnail_index](https://res.iowen.cn/wp-content/uploads/2019/08/iowen_2019-08-27_01-22-37.jpg)
61-
![Thumbnail_index](https://res.iowen.cn/wp-content/uploads/2019/08/iowen_2019-08-27_01-27-48.png)
62+
![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/05.jpg)
63+
![Thumbnail_index](https://owen0o0.github.io/ioStaticResources/webstack/06.png)
6264
<br/>
6365

6466
### 感谢

archive.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
<?php
2+
/*
3+
* @Theme Name:WebStack
4+
* @Theme URI:https://www.iotheme.cn/
5+
* @Author: iowen
6+
* @Author URI: https://www.iowen.cn/
7+
* @Date: 2020-02-22 21:26:05
8+
* @LastEditors: iowen
9+
* @LastEditTime: 2021-08-22 22:26:36
10+
* @FilePath: \WebStack\archive.php
11+
* @Description:
12+
*/
213
if ( ! defined( 'ABSPATH' ) ) { exit; }
314
get_header(); ?>
415

@@ -29,7 +40,7 @@
2940
<?php while ( have_posts() ) : the_post();
3041
$link_url = get_post_meta($post->ID, '_sites_link', true);
3142
$default_ico = get_template_directory_uri() .'/images/favicon.png';
32-
if(current_user_can('level_10') || get_post_meta($post->ID, '_visible', true)!="true"):
43+
if(current_user_can('level_10') || get_post_meta($post->ID, '_visible', true)==""):
3344
?>
3445
<div class="xe-card <?php echo io_get_option('columns') ?> <?php echo get_post_meta($post->ID, '_wechat_qr', true)? 'wechat':''?>">
3546
<?php include( 'templates/site-card.php' ); ?>

css/nav.css

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

footer.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
<?php if ( ! defined( 'ABSPATH' ) ) { exit; }?>
1+
<?php
2+
/*
3+
* @Theme Name:WebStack
4+
* @Theme URI:https://www.iotheme.cn/
5+
* @Author: iowen
6+
* @Author URI: https://www.iowen.cn/
7+
* @Date: 2019-02-22 21:26:02
8+
* @LastEditors: iowen
9+
* @LastEditTime: 2021-08-22 17:31:58
10+
* @FilePath: \WebStack\footer.php
11+
* @Description:
12+
*/
13+
if ( ! defined( 'ABSPATH' ) ) { exit; }?>
214
<footer class="main-footer sticky footer-type-1">
315
<div class="go-up">
416
<a href="#" rel="go-top">
@@ -8,7 +20,7 @@
820
<div class="footer-inner">
921
<div class="footer-text">
1022
Copyright © <?php echo date('Y') ?> <?php bloginfo('name'); ?> <?php if(io_get_option('icp')) echo '<a href="http://www.beian.miit.gov.cn/" target="_blank" rel="link noopener">' . io_get_option('icp') . '</a>'?>
11-
&nbsp;&nbsp;Design by <a href="http://webstack.cc" target="_blank"><strong>Webstack</strong></a>&nbsp;&nbsp;Modify by <a href="https://www.iowen.cn" target="_blank"><strong>一为</strong></a>
23+
&nbsp;&nbsp;Design by <a href="http://webstack.cc" target="_blank"><strong>Webstack</strong></a>&nbsp;&nbsp;Modify by <a href="https://www.iotheme.cn" target="_blank"><strong>一为</strong></a>
1224
</div>
1325
</div>
1426
</footer>

inc/fav-content.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
<?php if ( ! defined( 'ABSPATH' ) ) { exit; }
1+
<?php
2+
/*
3+
* @Theme Name:WebStack
4+
* @Theme URI:https://www.iotheme.cn/
5+
* @Author: iowen
6+
* @Author URI: https://www.iowen.cn/
7+
* @Date: 2020-02-22 21:26:05
8+
* @LastEditors: iowen
9+
* @LastEditTime: 2021-08-22 22:25:43
10+
* @FilePath: \WebStack\inc\fav-content.php
11+
* @Description:
12+
*/
13+
if ( ! defined( 'ABSPATH' ) ) { exit; }
214
function fav_con($mid) { ?>
315
<h4 class="text-gray" style="display: inline-block;"><i class="icon-io-tag" style="margin-right: 27px;" id="<?php echo $mid->name; ?>"></i><?php echo $mid->name; ?></h4>
416
<?php
@@ -39,7 +51,7 @@ function fav_con($mid) { ?>
3951
elseif ($myposts->have_posts()): while ($myposts->have_posts()): $myposts->the_post();
4052
$link_url = get_post_meta($post->ID, '_sites_link', true);
4153
$default_ico = get_template_directory_uri() .'/images/favicon.png';
42-
if(current_user_can('level_10') || get_post_meta($post->ID, '_visible', true)!="true"):
54+
if(current_user_can('level_10') || get_post_meta($post->ID, '_visible', true)==""):
4355
?>
4456
<div class="xe-card <?php echo io_get_option('columns') ?> <?php echo get_post_meta($post->ID, '_wechat_qr', true)? 'wechat':''?>">
4557
<?php include( get_theme_file_path() .'/templates/site-card.php' ); ?>

inc/frame/assets/css/cs-framework-light.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@
148148
}
149149

150150
.cs-field-upload .button {
151-
position: absolute;
152-
top: 34px;
153-
right: 32px;
151+
margin-top: 10px;
154152
}
155153

156154
/* Seperator */

inc/frame/classes/metabox.class.php

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function render_meta_box_content( $post, $callback ) {
6767
$sections = $callback['args']['sections'];
6868
$meta_value = get_post_meta( $post->ID, $unique, true );
6969
$transient = get_transient( 'cs-metabox-transient' );
70-
$cs_errors = $transient['errors'];
70+
//$cs_errors = $transient['errors'];
7171
$has_nav = ( count( $sections ) >= 2 && $callback['args']['context'] != 'side' ) ? true : false;
7272
$show_all = ( ! $has_nav ) ? ' cs-show-all' : '';
7373
$section_id = ( ! empty( $transient['ids'][$unique] ) ) ? $transient['ids'][$unique] : '';
@@ -125,7 +125,11 @@ public function render_meta_box_content( $post, $callback ) {
125125

126126
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
127127
$elem_id = ( isset( $field['id'] ) ) ? $field['id'] : '';
128-
$elem_value = ( is_array( $meta_value ) && isset( $meta_value[$elem_id] ) ) ? $meta_value[$elem_id] : $default;
128+
if($callback['args']['data_type'] !== 'serialize' ) {//iotheme.cn
129+
$elem_value = get_term_meta($post->ID, $elem_id,true);
130+
}else{
131+
$elem_value = ( is_array( $meta_value ) && isset( $meta_value[$elem_id] ) ) ? $meta_value[$elem_id] : $default;
132+
}//iotheme.cn
129133
echo cs_add_element( $field, $elem_value, $unique );
130134

131135
}
@@ -199,11 +203,15 @@ public function save_post( $post_id, $post ) {
199203

200204
if( ! empty( $validate ) ) {
201205

202-
$meta_value = get_post_meta( $post_id, $request_key, true );
203-
204206
$errors[$field['id']] = array( 'code' => $field['id'], 'message' => $validate, 'type' => 'error' );
205207
$default_value = isset( $field['default'] ) ? $field['default'] : '';
206-
$request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value;
208+
if($request_value['data_type'] !== 'serialize' ) {//iotheme.cn
209+
if($meta_value = get_post_meta($post_id, $field['id'],true))
210+
$request[$field['id']] = $meta_value ;
211+
}else{
212+
$meta_value = get_post_meta( $post_id, $request_key, true );
213+
$request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value;
214+
}//iotheme.cn
207215

208216
}
209217

@@ -219,15 +227,36 @@ public function save_post( $post_id, $post ) {
219227

220228
$request = apply_filters( 'cs_save_post', $request, $request_key, $post );
221229

222-
if( empty( $request ) ) {
230+
//if( empty( $request ) ) {
223231

224-
delete_post_meta( $post_id, $request_key );
232+
//delete_post_meta( $post_id, $request_key );
225233

226-
} else {
234+
//} else {
227235

228-
update_post_meta( $post_id, $request_key, $request );
236+
//update_post_meta( $post_id, $request_key, $request );
229237

230-
}
238+
//}
239+
if ( empty( $request ) ) {//iotheme.cn
240+
241+
if ( $request_value['data_type'] !== 'serialize' ) {
242+
foreach ( $request as $key => $value ) {
243+
delete_post_meta( $post_id, $key );
244+
}
245+
} else {
246+
delete_post_meta( $post_id, $request_key );
247+
}
248+
249+
} else {
250+
251+
if ( $request_value['data_type'] !== 'serialize' ) {
252+
foreach ( $request as $key => $value ) {
253+
update_post_meta( $post_id, $key, $value );
254+
}
255+
} else {
256+
update_post_meta( $post_id, $request_key, $request );
257+
}
258+
259+
}//iotheme.cn
231260

232261
$transient['ids'][$request_key] = cs_get_vars( 'cs_section_id', $request_key );
233262
$transient['errors'] = $errors;

inc/frame/classes/taxonomy.class.php

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,14 @@ public function render_taxonomy_form_fields( $term ) {
9393

9494
$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
9595
$elem_id = ( isset( $field['id'] ) ) ? $field['id'] : '';
96-
$elem_value = ( is_array( $tax_value ) && isset( $tax_value[$elem_id] ) ) ? $tax_value[$elem_id] : $default;
96+
$elem_value = $default;//iotheme.cn
97+
if ($form_edit){
98+
if($option['data_type'] !== 'serialize' ) {
99+
$elem_value = get_term_meta($term->term_id, $elem_id,true);
100+
}else{
101+
$elem_value = ( is_array( $tax_value ) && isset( $tax_value[$elem_id] ) ) ? $tax_value[$elem_id] : $default;
102+
}
103+
}//iotheme.cn
97104

98105
echo cs_add_element( $field, $elem_value, $option['id'] );
99106

@@ -153,11 +160,15 @@ public function save_taxonomy( $term_id ) {
153160

154161
if( ! empty( $validate ) ) {
155162

156-
$meta_value = get_term_meta( $term_id, $request_key, true );
157-
158163
$errors[$field['id']] = array( 'code' => $field['id'], 'message' => $validate, 'type' => 'error' );
159164
$default_value = isset( $field['default'] ) ? $field['default'] : '';
160-
$request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value;
165+
if($request_value['data_type'] !== 'serialize' ) {//iotheme.cn
166+
if($meta_value = get_term_meta($term_id, $field['id'],true))
167+
$request[$field['id']] = $meta_value ;
168+
}else{
169+
$meta_value = get_term_meta( $term_id, $request_key, true );
170+
$request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value;
171+
}//iotheme.cn
161172

162173
}
163174

@@ -173,19 +184,23 @@ public function save_taxonomy( $term_id ) {
173184

174185
if( empty( $request ) ) {
175186

176-
delete_term_meta( $term_id, $request_key );
187+
if ( $request_value['data_type'] !== 'serialize' ) {//iotheme.cn
188+
foreach ( $request as $key => $value ) {
189+
delete_term_meta( $term_id, $key );
190+
}
191+
} else {
192+
delete_term_meta( $term_id, $request_key );
193+
}//iotheme.cn
177194

178195
} else {
179196

180-
if( get_term_meta( $term_id, $request_key, true ) ) {
181-
182-
update_term_meta( $term_id, $request_key, $request );
183-
197+
if ( $request_value['data_type'] !== 'serialize' ) {//iotheme.cn
198+
foreach ( $request as $key => $value ) {
199+
update_term_meta( $term_id, $key, $value );
200+
}
184201
} else {
185-
186-
add_term_meta( $term_id, $request_key, $request );
187-
188-
}
202+
update_term_meta( $term_id, $request_key, $request );
203+
}//iotheme.cn
189204

190205
}
191206

@@ -210,9 +225,13 @@ public function delete_taxonomy( $term_id ) {
210225

211226
if( $taxonomy == $request_value['taxonomy'] ) {
212227

213-
$request_key = $request_value['id'];
214-
215-
delete_term_meta( $term_id, $request_key );
228+
if ( $request_value['data_type'] !== 'serialize' ) {//iotheme.cn
229+
foreach( $request_value['fields'] as $field ) {
230+
delete_term_meta( $term_id, $field['id'] );
231+
}
232+
} else {
233+
delete_term_meta( $term_id, $request_value['id'] );
234+
}//iotheme.cn
216235

217236
}
218237

inc/frame/config/framework.config.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
1+
<?php
2+
/*
3+
* @Theme Name:WebStack
4+
* @Theme URI:https://www.iotheme.cn/
5+
* @Author: iowen
6+
* @Author URI: https://www.iowen.cn/
7+
* @Date: 2019-02-22 21:26:02
8+
* @LastEditors: iowen
9+
* @LastEditTime: 2021-08-22 18:35:36
10+
* @FilePath: \WebStack\inc\frame\config\framework.config.php
11+
* @Description:
12+
*/
13+
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
214
// ===============================================================================================
315
// -----------------------------------------------------------------------------------------------
416
// FRAMEWORK SETTINGS
@@ -11,8 +23,8 @@
1123
'menu_position' => 59,
1224
'menu_icon' => CS_URI.'/assets/images/setting.png',
1325
'ajax_save' => true,
14-
'show_reset_all' => true,
15-
'framework_title' => 'WebStack '.__('主题设置','io_setting').'<style>.cs-framework .cs-body {min-height: 700px;}</style><span style="font-size: 14px;"> - V '.wp_get_theme()->get('Version').'</span> <a href="https://www.iowen.cn/webstack-pro-navigation-theme-advanced/" target="_blank">升级pro</a>',
26+
'show_reset_all' => false,
27+
'framework_title' => 'WebStack '.__('主题设置','io_setting').'<style>.cs-framework .cs-body {min-height: 700px;}</style><span style="font-size: 14px;"> - V '.wp_get_theme()->get('Version').'</span> <a href="https://www.iotheme.cn/store/onenav.html" target="_blank">go pro</a>',
1628
//'framework_title' => '主题设置',
1729
);
1830

@@ -37,6 +49,11 @@
3749
'content' => '---》<a href="https://www.iowen.cn/wordpress-version-webstack/" target="_blank">查看教程</a>《---',
3850
'class' => 'info',
3951
),
52+
array(
53+
'type' => 'notice',
54+
'content' => '---》<a href="https://www.iotheme.cn/help" target="_blank">帮助中心</a>《---',
55+
'class' => 'info',
56+
),
4057
array(
4158
'id' => 'logo_normal',
4259
'type' => 'image',
@@ -199,15 +216,15 @@
199216
'id' => 'ico_url',
200217
'type' => 'text',
201218
'title' => '图标源',
202-
'default' => 'https://api.ooopn.com/ico/api.php?url=',
219+
'default' => 'https://ico.mikelin.cn/',
203220
'desc' => 'api 地址',
204-
'after' => '如果获取图标失效,请百度搜索‘获取网站图标api’替换能用的就可以了<br>或者自建api服务,源码地址:<a href="https://www.iowen.cn/favicon-api/" target="_blank">https://www.iowen.cn/favicon-api/</a>',
221+
'after' => '默认api地址:https://ico.mikelin.cn/<br>如果获取图标失效,请百度搜索‘获取网站图标api’替换能用的就可以了<br>或者自建api服务,源码地址:<a href="https://www.iowen.cn/favicon-api/" target="_blank">https://www.iowen.cn/favicon-api/</a>',
205222
),
206223
array(
207224
'id' => 'url_format',
208225
'type' => 'switcher',
209226
'title' => '不包含 http(s)://',
210-
'default' => false,
227+
'default' => true,
211228
'desc' => '根据图标源 api 要求设置,如果api要求不能包含协议名称,请开启此选项',
212229
),
213230
array(

0 commit comments

Comments
 (0)