This file contains 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
<?php | |
/* | |
Author: Jim Westergren & Jeedo Aquino | |
File: index-with-redis.php | |
Updated: 2012-10-25 | |
This is a redis caching system for wordpress. | |
see more here: www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/ |
This file contains 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
//* Enqueue scripts and styles | |
//* https://wordpress.org/support/topic/how-to-dequeuederegister-js-and-css-on-no-checkout-pages/ | |
add_action( 'wp_enqueue_scripts', 'dots_disable_woocommerce_loading_css_js' ); | |
function dots_disable_woocommerce_loading_css_js() { | |
// Check if WooCommerce plugin is active | |
if( function_exists( 'is_woocommerce' ) ){ | |
// Check if it’s any of WooCommerce page |
This file contains 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
//* http://crunchify.com/how-to-stop-loading-woocommerce-js-javascript-and-css-files-on-all-wordpress-postspages/ | |
//* Enqueue scripts and styles | |
add_action( 'wp_enqueue_scripts', 'crunchify_disable_woocommerce_loading_css_js' ); | |
function crunchify_disable_woocommerce_loading_css_js() { | |
// Check if WooCommerce plugin is active | |
if( function_exists( 'is_woocommerce' ) ){ | |
This file contains 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
//Adding this snippet to the functions.php of your wordpress theme will add the nofollow attribute to category specific links within the_content. | |
function nofollow_cat_posts($text) { | |
global $post; | |
if( in_category(1) ) { // SET CATEGORY ID HERE | |
$text = stripslashes(wp_rel_nofollow($text)); | |
} | |
return $text; | |
} | |
add_filter('the_content', 'nofollow_cat_posts'); |
This file contains 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
/** | |
* Disable Google Open Sans font in the Admin area . Implementation idea from ... https://wordpress.org/plugins/disable-google-fonts/ | |
*/ | |
function myplugin_admin_area_minus_open_sans_style() { | |
// Remove Open Sans. Doesn't work :-( | |
// See 'Disable_Google_Fonts' class below as an alternative. | |
wp_dequeue_style('open-sans-css'); | |
// Add custom style definitions to compensate for the removal of Open Sans | |
wp_enqueue_style('myplugin-admin-minus-open-sans', plugins_url( 'css/admin-minus-open-sans.css', __FILE__ ), false, '1.0.0', 'all'); |
This file contains 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
/*-----------------------------------------------------------------------------------*/ | |
/* html minify snippet class for wordpress (important!) | |
/*-----------------------------------------------------------------------------------*/ | |
class WP_HTML_Compression { | |
protected $compress_css = true; | |
protected $compress_js = true; | |
protected $info_comment = true; | |
protected $remove_comments = true; | |
This file contains 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
/*-----------------------------------------------------------------------------------*/ | |
/* 后台增加允许复制文章和页面的选项 Duplicate Posts and Pages | |
/*-----------------------------------------------------------------------------------*/ | |
/* | |
* Function creates post duplicate as a draft and redirects then to the edit post screen | |
*/ | |
function rd_duplicate_post_as_draft(){ | |
global $wpdb; | |
if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) { |
This file contains 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
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
This file contains 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
### Nginx main config: Tweaks & SSL settings (without the FastCGI-cache config parts) | |
## http {} block: | |
http { | |
# [...] | |
server_tokens off; | |
reset_timedout_connection on; |
This file contains 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
<?php | |
/** | |
* Plugin Name: https Fix for enqueue scripts/styles | |
*/ | |
// Fix some badly enqueued scripts with no sense of HTTPS for the back end only. | |
// Kudos to http://snippets.webaware.com.au/snippets/cleaning-up-wordpress-plugin-script-and-stylesheet-loads-over-ssl/ | |
add_action( 'wp_print_scripts', 'fb_enqueueScriptsFix', 100 ); | |
add_action( 'wp_print_styles', 'fb_enqueueStylesFix', 100 ); |