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 | |
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
<?php | |
add_image_size( 'custom-size', 220, 180 ); // 220 pixels wide by 180 pixels tall, soft proportional crop mode | |
add_image_size( 'custom-size', 220, 180, true ); // 220 pixels wide by 180 pixels tall, hard crop mode | |
add_image_size( 'custom-size', 220, 220, array( 'left', 'top' ) ); // Hard crop left top | |
/* | |
For Media Library Images (Admin): | |
-------------------------------- | |
You can also make your custom sizes selectable from your WordPress admin. |
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 | |
// 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
// This code throws error: logStr is not define | |
swal({ | |
title: "Problem", | |
text: "Problem processing request !", | |
type: "Error" | |
}); | |
// This code works perfect | |
// type argument accepts following: error,success,info,warning | |
// type is case sensitive "Error" in place of "error" will throw error |
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 | |
/* | |
mPDF: Generate PDF from HTML/CSS (Complete Code) | |
*/ | |
require_once( 'mpdf/mpdf.php'); // Include mdpf | |
$stylesheet = file_get_contents('assets/css/pdf.css'); // Get css content | |
$html = '<div id="pdf-content"> | |
Your PDF Content goes here (Text/HTML) | |
</div>'; |
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
.yoast-settings { | |
display: none; | |
} |
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(); |
NewerOlder