Skip to content

Commit

Permalink
20210822
Browse files Browse the repository at this point in the history
修复网址编辑时删除图标按钮失效
修复部分错误
增加网址分类快速添加图标的方法(更新后需按照新方法重新添加图标)
修改网址块简介为显示一行,且优化块布局
更换二维码api
更换自动网址图标 api
  • Loading branch information
owen0o0 committed Aug 22, 2021
1 parent 4ec7db0 commit f733f8f
Show file tree
Hide file tree
Showing 27 changed files with 462 additions and 301 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# WebStack
WordPress 版 WebStack 主题
WordPress 版 WebStack 主题。<a href="http://webstack.iotheme.cn/">前往演示站</a>
<br/>

### 首页截图
<br/>

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

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

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

### 后台截图
<br/>

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

### 感谢
Expand Down
13 changes: 12 additions & 1 deletion archive.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
<?php
/*
* @Theme Name:WebStack
* @Theme URI:https://www.iotheme.cn/
* @Author: iowen
* @Author URI: https://www.iowen.cn/
* @Date: 2020-02-22 21:26:05
* @LastEditors: iowen
* @LastEditTime: 2021-08-22 22:26:36
* @FilePath: \WebStack\archive.php
* @Description:
*/
if ( ! defined( 'ABSPATH' ) ) { exit; }
get_header(); ?>

Expand Down Expand Up @@ -29,7 +40,7 @@
<?php while ( have_posts() ) : the_post();
$link_url = get_post_meta($post->ID, '_sites_link', true);
$default_ico = get_template_directory_uri() .'/images/favicon.png';
if(current_user_can('level_10') || get_post_meta($post->ID, '_visible', true)!="true"):
if(current_user_can('level_10') || get_post_meta($post->ID, '_visible', true)==""):
?>
<div class="xe-card <?php echo io_get_option('columns') ?> <?php echo get_post_meta($post->ID, '_wechat_qr', true)? 'wechat':''?>">
<?php include( 'templates/site-card.php' ); ?>
Expand Down
8 changes: 6 additions & 2 deletions css/nav.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions footer.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<?php if ( ! defined( 'ABSPATH' ) ) { exit; }?>
<?php
/*
* @Theme Name:WebStack
* @Theme URI:https://www.iotheme.cn/
* @Author: iowen
* @Author URI: https://www.iowen.cn/
* @Date: 2019-02-22 21:26:02
* @LastEditors: iowen
* @LastEditTime: 2021-08-22 17:31:58
* @FilePath: \WebStack\footer.php
* @Description:
*/
if ( ! defined( 'ABSPATH' ) ) { exit; }?>
<footer class="main-footer sticky footer-type-1">
<div class="go-up">
<a href="#" rel="go-top">
Expand All @@ -8,7 +20,7 @@
<div class="footer-inner">
<div class="footer-text">
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>'?>
&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>
&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>
</div>
</div>
</footer>
Expand Down
16 changes: 14 additions & 2 deletions inc/fav-content.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<?php if ( ! defined( 'ABSPATH' ) ) { exit; }
<?php
/*
* @Theme Name:WebStack
* @Theme URI:https://www.iotheme.cn/
* @Author: iowen
* @Author URI: https://www.iowen.cn/
* @Date: 2020-02-22 21:26:05
* @LastEditors: iowen
* @LastEditTime: 2021-08-22 22:25:43
* @FilePath: \WebStack\inc\fav-content.php
* @Description:
*/
if ( ! defined( 'ABSPATH' ) ) { exit; }
function fav_con($mid) { ?>
<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>
<?php
Expand Down Expand Up @@ -39,7 +51,7 @@ function fav_con($mid) { ?>
elseif ($myposts->have_posts()): while ($myposts->have_posts()): $myposts->the_post();
$link_url = get_post_meta($post->ID, '_sites_link', true);
$default_ico = get_template_directory_uri() .'/images/favicon.png';
if(current_user_can('level_10') || get_post_meta($post->ID, '_visible', true)!="true"):
if(current_user_can('level_10') || get_post_meta($post->ID, '_visible', true)==""):
?>
<div class="xe-card <?php echo io_get_option('columns') ?> <?php echo get_post_meta($post->ID, '_wechat_qr', true)? 'wechat':''?>">
<?php include( get_theme_file_path() .'/templates/site-card.php' ); ?>
Expand Down
4 changes: 1 addition & 3 deletions inc/frame/assets/css/cs-framework-light.css
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@
}

.cs-field-upload .button {
position: absolute;
top: 34px;
right: 32px;
margin-top: 10px;
}

/* Seperator */
Expand Down
49 changes: 39 additions & 10 deletions inc/frame/classes/metabox.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function render_meta_box_content( $post, $callback ) {
$sections = $callback['args']['sections'];
$meta_value = get_post_meta( $post->ID, $unique, true );
$transient = get_transient( 'cs-metabox-transient' );
$cs_errors = $transient['errors'];
//$cs_errors = $transient['errors'];
$has_nav = ( count( $sections ) >= 2 && $callback['args']['context'] != 'side' ) ? true : false;
$show_all = ( ! $has_nav ) ? ' cs-show-all' : '';
$section_id = ( ! empty( $transient['ids'][$unique] ) ) ? $transient['ids'][$unique] : '';
Expand Down Expand Up @@ -125,7 +125,11 @@ public function render_meta_box_content( $post, $callback ) {

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

}
Expand Down Expand Up @@ -199,11 +203,15 @@ public function save_post( $post_id, $post ) {

if( ! empty( $validate ) ) {

$meta_value = get_post_meta( $post_id, $request_key, true );

$errors[$field['id']] = array( 'code' => $field['id'], 'message' => $validate, 'type' => 'error' );
$default_value = isset( $field['default'] ) ? $field['default'] : '';
$request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value;
if($request_value['data_type'] !== 'serialize' ) {//iotheme.cn
if($meta_value = get_post_meta($post_id, $field['id'],true))
$request[$field['id']] = $meta_value ;
}else{
$meta_value = get_post_meta( $post_id, $request_key, true );
$request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value;
}//iotheme.cn

}

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

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

if( empty( $request ) ) {
//if( empty( $request ) ) {

delete_post_meta( $post_id, $request_key );
//delete_post_meta( $post_id, $request_key );

} else {
//} else {

update_post_meta( $post_id, $request_key, $request );
//update_post_meta( $post_id, $request_key, $request );

}
//}
if ( empty( $request ) ) {//iotheme.cn

if ( $request_value['data_type'] !== 'serialize' ) {
foreach ( $request as $key => $value ) {
delete_post_meta( $post_id, $key );
}
} else {
delete_post_meta( $post_id, $request_key );
}

} else {

if ( $request_value['data_type'] !== 'serialize' ) {
foreach ( $request as $key => $value ) {
update_post_meta( $post_id, $key, $value );
}
} else {
update_post_meta( $post_id, $request_key, $request );
}

}//iotheme.cn

$transient['ids'][$request_key] = cs_get_vars( 'cs_section_id', $request_key );
$transient['errors'] = $errors;
Expand Down
51 changes: 35 additions & 16 deletions inc/frame/classes/taxonomy.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,14 @@ public function render_taxonomy_form_fields( $term ) {

$default = ( isset( $field['default'] ) ) ? $field['default'] : '';
$elem_id = ( isset( $field['id'] ) ) ? $field['id'] : '';
$elem_value = ( is_array( $tax_value ) && isset( $tax_value[$elem_id] ) ) ? $tax_value[$elem_id] : $default;
$elem_value = $default;//iotheme.cn
if ($form_edit){
if($option['data_type'] !== 'serialize' ) {
$elem_value = get_term_meta($term->term_id, $elem_id,true);
}else{
$elem_value = ( is_array( $tax_value ) && isset( $tax_value[$elem_id] ) ) ? $tax_value[$elem_id] : $default;
}
}//iotheme.cn

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

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

if( ! empty( $validate ) ) {

$meta_value = get_term_meta( $term_id, $request_key, true );

$errors[$field['id']] = array( 'code' => $field['id'], 'message' => $validate, 'type' => 'error' );
$default_value = isset( $field['default'] ) ? $field['default'] : '';
$request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value;
if($request_value['data_type'] !== 'serialize' ) {//iotheme.cn
if($meta_value = get_term_meta($term_id, $field['id'],true))
$request[$field['id']] = $meta_value ;
}else{
$meta_value = get_term_meta( $term_id, $request_key, true );
$request[$field['id']] = ( isset( $meta_value[$field['id']] ) ) ? $meta_value[$field['id']] : $default_value;
}//iotheme.cn

}

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

if( empty( $request ) ) {

delete_term_meta( $term_id, $request_key );
if ( $request_value['data_type'] !== 'serialize' ) {//iotheme.cn
foreach ( $request as $key => $value ) {
delete_term_meta( $term_id, $key );
}
} else {
delete_term_meta( $term_id, $request_key );
}//iotheme.cn

} else {

if( get_term_meta( $term_id, $request_key, true ) ) {

update_term_meta( $term_id, $request_key, $request );

if ( $request_value['data_type'] !== 'serialize' ) {//iotheme.cn
foreach ( $request as $key => $value ) {
update_term_meta( $term_id, $key, $value );
}
} else {

add_term_meta( $term_id, $request_key, $request );

}
update_term_meta( $term_id, $request_key, $request );
}//iotheme.cn

}

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

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

$request_key = $request_value['id'];

delete_term_meta( $term_id, $request_key );
if ( $request_value['data_type'] !== 'serialize' ) {//iotheme.cn
foreach( $request_value['fields'] as $field ) {
delete_term_meta( $term_id, $field['id'] );
}
} else {
delete_term_meta( $term_id, $request_value['id'] );
}//iotheme.cn

}

Expand Down
29 changes: 23 additions & 6 deletions inc/frame/config/framework.config.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
<?php
/*
* @Theme Name:WebStack
* @Theme URI:https://www.iotheme.cn/
* @Author: iowen
* @Author URI: https://www.iowen.cn/
* @Date: 2019-02-22 21:26:02
* @LastEditors: iowen
* @LastEditTime: 2021-08-22 18:35:36
* @FilePath: \WebStack\inc\frame\config\framework.config.php
* @Description:
*/
if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access pages directly.
// ===============================================================================================
// -----------------------------------------------------------------------------------------------
// FRAMEWORK SETTINGS
Expand All @@ -11,8 +23,8 @@
'menu_position' => 59,
'menu_icon' => CS_URI.'/assets/images/setting.png',
'ajax_save' => true,
'show_reset_all' => true,
'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>',
'show_reset_all' => false,
'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>',
//'framework_title' => '主题设置',
);

Expand All @@ -37,6 +49,11 @@
'content' => '---》<a href="https://www.iowen.cn/wordpress-version-webstack/" target="_blank">查看教程</a>《---',
'class' => 'info',
),
array(
'type' => 'notice',
'content' => '---》<a href="https://www.iotheme.cn/help" target="_blank">帮助中心</a>《---',
'class' => 'info',
),
array(
'id' => 'logo_normal',
'type' => 'image',
Expand Down Expand Up @@ -199,15 +216,15 @@
'id' => 'ico_url',
'type' => 'text',
'title' => '图标源',
'default' => 'https://api.ooopn.com/ico/api.php?url=',
'default' => 'https://ico.mikelin.cn/',
'desc' => 'api 地址',
'after' => '如果获取图标失效,请百度搜索‘获取网站图标api’替换能用的就可以了<br>或者自建api服务,源码地址:<a href="https://www.iowen.cn/favicon-api/" target="_blank">https://www.iowen.cn/favicon-api/</a>',
'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>',
),
array(
'id' => 'url_format',
'type' => 'switcher',
'title' => '不包含 http(s)://',
'default' => false,
'default' => true,
'desc' => '根据图标源 api 要求设置,如果api要求不能包含协议名称,请开启此选项',
),
array(
Expand Down
Loading

0 comments on commit f733f8f

Please sign in to comment.