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
//Scenario 1: String & Math calculation | |
"height :" + $(document).height() - $(window).height(); | |
//Result: NaN | |
//Scenario 2: String & Math calculation with parentheses | |
"height :" + ($(document).height() - $(window).height()); | |
//Result: Height : 1870 | |
//Scenario 3: String without match calculation | |
"Height:" + $(document).height(); |
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 | |
// Reomve unsupported payment gateway | |
function payment_gateway_disable_for_country( $available_gateways ) { | |
global $woocommerce; | |
if ( isset( $available_gateways['instamojo'] ) && $woocommerce->customer->get_country() != 'IN' ) { | |
unset( $available_gateways['instamojo'] ); | |
} | |
return $available_gateways; | |
} |
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 | |
/* | |
* Remove theme editor from backend | |
*/ | |
function remove_editor_menu() { | |
remove_action('admin_menu', '_add_themes_utility_last', 101); | |
} | |
add_action('_admin_menu', 'remove_editor_menu', 1); | |
?> |
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 | |
/** | |
* Remove the WooThemes Helper plugin nag on admin screen | |
*/ | |
add_action( 'init', 'lubus_remove_woo_nag' ); | |
function lubus_remove_woo_nag() { | |
remove_action( 'admin_notices', 'woothemes_updater_notice' ); | |
} |
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 | |
add_action('admin_menu','wphidenag'); | |
function wphidenag() { | |
remove_action( 'admin_notices', 'update_nag', 3 ); | |
} | |
?> |
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
/** | |
* Forces all PDF links to download automatically, if the browser supports it. | |
* Otherwise, open the link in a new browser window or tab. | |
*/ | |
jQuery(document).ready(function($) { | |
$('a[href$=".pdf"]') | |
.attr('download', '') | |
.attr('target', '_blank'); | |
}); |
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 | |
/** | |
* Check the status of a plugin. | |
* | |
* @param string $location Base plugin path from plugins directory. | |
* @return int 1 if active; 2 if inactive; 0 if not installed | |
*/ | |
function get_plugin_status($location = '') { | |
if(is_plugin_active($location)) { |
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 | |
/** | |
* http://stackoverflow.com/questions/5327920/how-to-generate-a-wordpress-plugin-install-link | |
**/ | |
$action = 'install-plugin'; | |
$slug = 'akismet'; | |
wp_nonce_url( | |
add_query_arg( |
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 | |
/* | |
* Generate a Link to Activate a Plugin in WordPress | |
*/ | |
$path = 'woocommerce/woocommerce.php'; | |
$link = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$path), 'activate-plugin_'.$path); | |
?> |
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
<IfModule mod_expires.c> | |
# Enable expirations | |
ExpiresActive On | |
# Default expiration: 1 hour after request | |
ExpiresDefault "now plus 1 hour" | |
# CSS and JS expiration: 1 week after request | |
ExpiresByType text/css "now plus 1 week" | |
ExpiresByType application/javascript "now plus 1 week" | |
ExpiresByType application/x-javascript "now plus 1 week" | |
# Image files expiration: 1 month after request |
OlderNewer