diff --git a/css/nav.css b/css/nav.css
index e7575ab..09e2c10 100644
--- a/css/nav.css
+++ b/css/nav.css
@@ -207,11 +207,19 @@ footer.main-footer{border-top:0;background-color:#fff}
.pt-4,.py-4{padding-top:3rem!important}
.border-top{border-top:1px solid rgba(130,130,130,.1)!important}
.main-content .tooltip{word-break:break-word}
+#bulletin_box{margin-top:60px;margin-bottom:-70px;padding:5px 10px}
+#bulletin_box .bulletin-ul{padding-left:10px}
+.bulletin{box-sizing:border-box;height:25px;line-height:25px;overflow:hidden}
+.bulletin ul{list-style-type:none;font-size:14px}
+.d-flex{display:-ms-flexbox!important;display:flex!important}
+.friendlink a{position:relative;display:inline-block;margin:.25rem 1rem .25rem .25rem;}
+.friendlink a:before{content:'\2022';display:inline-block;position:relative;margin-right:5px}
/*.ad{overflow:hidden}*/
.ad img{width:100%;max-height:350px}
.ad-home img,.ad-footer img{max-height:150px}
@media screen and (max-width:767px){.main-content.page{padding-left:15px;padding-right:15px}
footer.main-footer .footer-text{text-align:center;float:none}
+#bulletin_box{margin-top:0;margin-bottom:10px}
.no-search{margin-top:0px}
.siteico:before{padding-top:60%}
.mt-sm-3,.my-sm-3{margin-top:2rem!important}
diff --git a/inc/frame/config/framework.config.php b/inc/frame/config/framework.config.php
index 3e361c7..89cd9d6 100644
--- a/inc/frame/config/framework.config.php
+++ b/inc/frame/config/framework.config.php
@@ -12,7 +12,7 @@
'menu_icon' => CS_URI.'/assets/images/setting.png',
'ajax_save' => true,
'show_reset_all' => true,
- 'framework_title' => 'WebStack '.__('主题设置','io_setting').' - V '.wp_get_theme()->get('Version').' 升级pro',
+ 'framework_title' => 'WebStack '.__('主题设置','io_setting').' - V '.wp_get_theme()->get('Version').' 升级pro',
//'framework_title' => '主题设置',
);
@@ -34,7 +34,7 @@
'fields' => array(
array(
'type' => 'notice',
- 'content' => '网站LOGO和Favicon设置',
+ 'content' => '---》查看教程《---',
'class' => 'info',
),
array(
@@ -116,6 +116,33 @@
'col-sm-4 col-md-3 col-lg-2' => '6'
),
),
+
+
+
+ array(
+ 'id' => 'bulletin',
+ 'type' => 'switcher',
+ 'title' => '显示公告',
+ 'desc' => '在首页顶部显示公告',
+ 'default' => true,
+ ),
+ array(
+ 'id' => 'bulletin_n',
+ 'type' => 'text',
+ 'title' => '公告数量',
+ 'after' => '需要显示的公告篇数',
+ 'default' => 2,
+ 'dependency' => array( 'bulletin', '==', 'true' )
+ ),
+ array(
+ 'id' => 'links',
+ 'type' => 'switcher',
+ 'title' => '友情链接',
+ 'label' => '在首页底部添加友情链接',
+ 'default' => true,
+ ),
+
+
array(
'type' => 'notice',
'content' => '其他设置',
@@ -172,21 +199,21 @@
'id' => 'ico_url',
'type' => 'text',
'title' => '图标源',
- 'default' => 'https://api.iowen.cn/favicon/',
+ 'default' => 'https://api.ooopn.com/ico/api.php?url=',
'desc' => 'api 地址',
+ 'after' => '如果获取图标失效,请百度搜索‘获取网站图标api’替换能用的就可以了
或者自建api服务,源码地址:https://www.iowen.cn/favicon-api/',
),
array(
'id' => 'url_format',
'type' => 'switcher',
'title' => '不包含 http(s)://',
- 'default' => true,
+ 'default' => false,
'desc' => '根据图标源 api 要求设置,如果api要求不能包含协议名称,请开启此选项',
),
array(
'id' => 'ico_png',
'type' => 'text',
'title' => '图标源api后缀',
- 'default' => '.png',
'desc' => '如:.png ,请根据api格式要求设置,如不需要请留空',
),
),
diff --git a/inc/inc.php b/inc/inc.php
index 43d704c..47d3c25 100644
--- a/inc/inc.php
+++ b/inc/inc.php
@@ -8,6 +8,9 @@
));
+//激活友情链接模块
+add_filter( 'pre_option_link_manager_enabled', '__return_true' );
+
require_once get_theme_file_path() .'/inc/frame/cs-framework.php';
require_once get_theme_file_path() .'/inc/register.php';
require_once get_theme_file_path() .'/inc/post-type.php';
@@ -464,42 +467,8 @@ function walker_nav_menu_start_el( $item_output, $item, $depth, $args ){
}
}
new iconfont();
-
-/**
- * 让搜索支持自定义文章
- */
-function include_post_types_in_search($query) {
- if(is_search()) {
- $post_types = get_post_types(array('public' => true, 'exclude_from_search' => false), 'objects');
- $searchable_types = array();
- if($post_types) {
- foreach( $post_types as $type) {
- $searchable_types[] = $type->name;
- }
- }
- $query->set('post_type', $searchable_types);
- }
- return $query;
-}
-//add_action('pre_get_posts', 'include_post_types_in_search');
-
-/**
- * 让搜索支持自定义字段
- */
-//add_action('posts_search', 'include_custom_fields_in_search',2,2);
-function include_custom_fields_in_search ($search, $query){
- global $wpdb;
-
- if ($query->is_main_query() && !empty($query->query['s'])) {
-
- $sql = " OR EXISTS (SELECT * FROM {$wpdb->postmeta} WHERE post_id={$wpdb->posts}.ID and meta_key = '_sites_sescribe' and meta_value like %s)";
- $like = '%' . $wpdb->esc_like($query->query['s']) . '%';
-
- $search .= $wpdb->prepare($sql, $like);
- }
- return $search;
-};
+
function format_url($url){
if($url == '')
@@ -514,6 +483,16 @@ function format_url($url){
}
}
+# 搜索只查询文章和网址。
+# --------------------------------------------------------------------
+add_filter('pre_get_posts','searchfilter');
+function searchfilter($query) {
+ //限定对搜索查询和非后台查询设置
+ if ($query->is_search && !is_admin() ) {
+ $query->set('post_type',array('sites','post'));
+ }
+ return $query;
+}
/**
* 修改搜索查询的sql代码,将postmeta表左链接进去。
diff --git a/inc/post-type.php b/inc/post-type.php
index 6a3208e..661fbb4 100644
--- a/inc/post-type.php
+++ b/inc/post-type.php
@@ -71,6 +71,48 @@ function create_sites_taxonomies() {
register_taxonomy( 'favorites', array( 'sites' ), $args );
}
+
+// 公告
+add_action( 'init', 'post_type_bulletin' );
+function post_type_bulletin() {
+ $labels = array(
+ 'name' => '公告', 'post type general name', 'your-plugin-textdomain',
+ 'singular_name' => '公告', 'post type singular name', 'your-plugin-textdomain',
+ 'menu_name' => '公告', 'admin menu', 'your-plugin-textdomain',
+ 'name_admin_bar' => '公告', 'add new on admin bar', 'your-plugin-textdomain',
+ 'add_new' => '发布公告', 'bulletin', 'your-plugin-textdomain',
+ 'add_new_item' => '发布新公告', 'your-plugin-textdomain',
+ 'new_item' => '新公告', 'your-plugin-textdomain',
+ 'edit_item' => '编辑公告', 'your-plugin-textdomain',
+ 'view_item' => '查看公告', 'your-plugin-textdomain',
+ 'all_items' => '所有公告', 'your-plugin-textdomain',
+ 'search_items' => '搜索公告', 'your-plugin-textdomain',
+ 'parent_item_colon' => 'Parent 公告:', 'your-plugin-textdomain',
+ 'not_found' => '你还没有发布公告。', 'your-plugin-textdomain',
+ 'not_found_in_trash' => '回收站中没有公告。', 'your-plugin-textdomain'
+ );
+
+ $args = array(
+ 'labels' => $labels,
+ 'public' => true,
+ 'publicly_queryable' => true,
+ 'show_ui' => true,
+ 'show_in_menu' => true,
+ 'query_var' => true,
+ 'rewrite' => array( 'slug' => 'bulletin' ),
+ 'capability_type' => 'post',
+ 'menu_icon' => 'dashicons-controls-volumeon',
+ 'has_archive' => false,
+ 'hierarchical' => false,
+ 'menu_position' => 10,
+ 'show_in_rest' => true,
+ 'supports' => array( 'title', 'editor', 'author', 'comments', 'custom-fields' )
+ );
+
+ register_post_type( 'bulletin', $args );
+}
+
+
/**
* 分类项目排序字段
*
diff --git a/index.php b/index.php
index f2e9848..21d6acd 100644
--- a/index.php
+++ b/index.php
@@ -16,6 +16,8 @@