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 | |
/** | |
* Password Peek | |
* | |
* Add focus toggle script to password-protected pages, so when the password field is focused, it will show the password. | |
* | |
* @package PDXWLF | |
*/ | |
/** |
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
function auto_select_gift() { | |
if ( is_single(56669) ) { //enter product id here | |
?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function ($) { | |
document.getElementById("gifting_0_option").click(); // Click on the checkbox | |
}); | |
</script> | |
<?php |
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
Search for : (.*(\n|$)){2} | |
alt+R - to toggle regular expression search | |
alt+ENTER - to select all results |
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
/** SCRIPTS FOR DESIGNATING WHEN ITEMS ARE LIKED, STORING THAT PREFERENCE, | |
AND LOADING THOSE PREFERENCES UPON PAGE REFRESH **/ | |
/** when you click on a featured heart, make it liked **/ | |
$(".solution_item .liked_status").click(function(){ | |
// create a variable that references the containing parent of heart just clicked | |
const self = $(this).parent(); | |
// create a variable that contains just the ID of the parent element | |
const likedToolID = self.attr("id"); |
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
/** Add tracking pixel if order contains product ID. Replace 11747 with your specific product ID */ | |
add_action( 'woocommerce_thankyou', 'bundleTracking' ); | |
function bundleTracking(){ | |
/* do nothing if we are not on the appropriate page */ | |
if( !is_wc_endpoint_url( 'order-received' ) || empty( $_GET['key'] ) ) { | |
return; | |
} |
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
/** Add a “Last Modified” Column in WordPress for pages and posts **/ | |
// Register the column | |
function modified_column_register( $columns ) { | |
$columns['modified_list'] = __( 'Modified', 'my-plugin' ); | |
return $columns; | |
} | |
add_filter( 'manage_edit-page_columns', 'modified_column_register' ); | |
add_filter( 'manage_edit-post_columns', 'modified_column_register' ); |
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
/** | |
* Show a message at the cart/checkout displaying | |
* how much to go for free shipping. | |
*/ | |
function wc_free_shipping_incentive_notice() { | |
if ( ! is_cart() && ! is_checkout() && ( WC()->cart->get_cart_contents_count() == 0 ) ) { | |
return; | |
} |
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
/*Update following in your WordPress theme's functions.php file */ | |
// Remove Query String from Static Resources | |
function remove_cssjs_ver( $src ) { | |
if( strpos( $src, '?ver=' ) ) | |
$src = remove_query_arg( 'ver', $src ); | |
return $src; | |
} | |
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 ); | |
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 ); |
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 | |
/* | |
* This code goes into theme functions.php or a custom plugin | |
*/ | |
/** | |
* Add product to cart on page load | |
*/ | |
function add_product_to_cart() { |
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
/* Hide WP version strings from scripts and styles | |
* @return {string} $src | |
* @filter script_loader_src | |
* @filter style_loader_src | |
*/ | |
function fjarrett_remove_wp_version_strings( $src ) { | |
global $wp_version; | |
parse_str(parse_url($src, PHP_URL_QUERY), $query); | |
if ( !empty($query['ver']) && $query['ver'] === $wp_version ) { | |
$src = remove_query_arg('ver', $src); |
NewerOlder