Last active
July 4, 2018 02:37
wordpress function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 访问计数 */ | |
function getPostViews($postID){ | |
$count_key = 'post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count==''){ | |
delete_post_meta($postID, $count_key); | |
add_post_meta($postID, $count_key, '0'); | |
return "0"; | |
} | |
return $count.''; | |
} | |
function setPostViews($postID) { | |
$count_key = 'post_views_count'; | |
$count = get_post_meta($postID, $count_key, true); | |
if($count==''){ | |
$count = 0; | |
delete_post_meta($postID, $count_key); | |
add_post_meta($postID, $count_key, '0'); | |
}else{ | |
$count++; | |
update_post_meta($postID, $count_key, $count); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//删除 google 字体 | |
add_filter('gettext_with_context', 'wpjam_disable_google_fonts', 888, 4); | |
function wpjam_disable_google_fonts($translations, $text, $context, $domain) | |
{ | |
$google_fonts_contexts = array('Open Sans font: on or off','Lato font: on or off','Source Sans Pro font: on or off','Bitter font: on or off'); | |
if ($text == 'on' && in_array($context, $google_fonts_contexts)) { | |
$translations = 'off'; | |
} | |
return $translations; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment