1
0
Fork 0
mirror of https://github.com/yunluo/gdk.git synced 2024-05-11 10:46:52 +02:00

于细节处优化

This commit is contained in:
云落 2020-02-12 00:27:35 +08:00
parent c1524a81d9
commit 7d8c4dd100
4 changed files with 14 additions and 17 deletions

View file

@ -1011,7 +1011,7 @@ function gdk_get_link_items() {
$result = '';
foreach ($linkcats as $linkcat) {
$result.= '<a id="' . $linkcat->term_id . '"></a><div class="panel">
<div class="panel-title card">' . $linkcat->name . '</div>
<div class="panel-title card"><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzODQgNTEyIj4gPHBhdGggZD0iTTMzNiAwSDQ4QzIxLjQ5IDAgMCAyMS40OSAwIDQ4djQ2NGwxOTItMTEyIDE5MiAxMTJWNDhjMC0yNi41MS0yMS40OS00OC00OC00OHptMCA0MjguNDNsLTE0NC04NC0xNDQgODRWNTRhNiA2IDAgMCAxIDYtNmgyNzZjMy4zMTQgMCA2IDIuNjgzIDYgNS45OTZWNDI4LjQzeiI+PC9wYXRoPiA8L3N2Zz4=">' . $linkcat->name . '</div>
<div class="panel-body">
<div class="row">';
$result.= gdk_get_the_link_items($linkcat->term_id);

View file

@ -49,7 +49,10 @@ add_filter( 'redirect_canonical', 'gdk_custom_cancel_redirect' );
//自定义路由参数,GO跳转和dl下载
function gdk_public_query_vars($public_query_vars){
array_push($public_query_vars, 'go','dl','sitemap','daohang');
$public_query_vars[] = 'go';
$public_query_vars[] = 'dl';
$public_query_vars[] = 'sitemap';
$public_query_vars[] = 'daohang';
return $public_query_vars;
}
add_action('query_vars', 'gdk_public_query_vars');

File diff suppressed because one or more lines are too long

View file

@ -1,12 +1,12 @@
<?php
/**
* sitemap xml
*/
function gdk_sitemap_xml_api_handlers( $template ){
$hook = explode('-', get_query_var( 'sitemap' ) );
if( isset( $hook[0] ) && $hook[0] === 'gdk' ){
if( isset( $hook[1] ) ){
status_header(404);
header('HTTP/1.0 404 Not Found');
@ -16,7 +16,6 @@ function gdk_sitemap_xml_api_handlers( $template ){
}
$sitemap = get_transient('gdk-sitemap');
if( false === $sitemap || empty( $sitemap ) ){
$sitemap = gdk_create_sitemap();
set_transient( 'gdk-sitemap', $sitemap );
@ -31,11 +30,9 @@ function gdk_sitemap_xml_api_handlers( $template ){
}
add_filter( 'template_include', 'gdk_sitemap_xml_api_handlers', 99 );
function gdk_create_sitemap() {
if ( str_replace( '-', '', get_option( 'gmt_offset' ) ) < 10 ) {
$tempo = '-0' . str_replace( '-', '', get_option( 'gmt_offset' ) );
} else {
@ -74,6 +71,6 @@ function gdk_create_sitemap() {
function gdk_clear_sitemap_cache(){
delete_transient( 'gdk-sitemap' );
}
add_action("publish_post", "gdk_clear_sitemap_cache");
add_action("publish_page", "gdk_clear_sitemap_cache");
add_action( "save_post", "gdk_clear_sitemap_cache" );
add_action('publish_post', 'gdk_clear_sitemap_cache');
add_action('publish_page', 'gdk_clear_sitemap_cache');
add_action('save_post', 'gdk_clear_sitemap_cache' );