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
const formatUSD = (value) => { | |
return new Intl.NumberFormat( | |
'en-US', | |
{ | |
style: 'currency', | |
currency: 'USD' | |
} | |
).format(value); | |
} |
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 | |
/** | |
* Manually calling wp_maybe_auto_update() results in plugins getting deactivated during the update process. | |
* WP assumes this function is run during cron, and it neither deactivates nor reactivates plugins during cron. | |
* When run outside of cron, it will deactivate plugins, but it assumes the browser will refresh and reactivate them. | |
* To prevent deactivated plugins when calling this function, we can trick the upgrader into thinking it's called during cron. | |
* | |
* @link https://stackoverflow.com/questions/41541968/plugins-are-getting-deactivated-after-automatic-plugin-update-in-wordpress | |
*/ |
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
#!/bin/bash | |
# Colors | |
VP_NONE='\033[00m' | |
VP_RED='\033[01;31m' | |
VP_GREEN='\033[01;32m' | |
VP_YELLOW='\033[01;33m' | |
VP_PURPLE='\033[01;35m' | |
VP_CYAN='\033[01;36m' | |
VP_WHITE='\033[01;37m' |
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_filter( 'the_content', 'add_rel_sponsored_affiliate_links' ); | |
/** | |
* Add rel="sponsored" to external affiliate links in WordPress. | |
* Affiliate links should be distinguishable through some kind of unique prefix. | |
* | |
* @param string $content Post content | |
* | |
* @return string |
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( 'mepr-txn-status-failed', 'my_custom_cleanup_memberpress_txn_failed', 15 ); | |
/** | |
* Runs a "cleanup" when a MemberPress transaction fails. | |
* This checks the transaction's user to see if they have any completed transactions. | |
* If the user only has incomplete transactions, it deletes the user. | |
* | |
* @param object $txn MeprTransaction object | |
* |
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( 'gform_pre_send_email', 'keywords_check' ); | |
/** | |
* Check the message field of the entry for bad words. | |
* If any are detected, silently discard the email and entry. | |
* | |
* @param array $email Email data | |
* @param string $format Email format (text or HTML) | |
* @param array $notification Notificaiton data |
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_filter( 'woocommerce_custom_redirects_redirect_url', 'wcr_filter_redirect' ); | |
/** | |
* Filters the custom redirect URL. | |
* Requires Custom Redirects for WooCommerce. | |
* @link http://wc-redirects.com/ | |
* | |
* @param string $redirect Redirect URL | |
* @param string $type Redirect type (add-to-cart or after-purchase) |
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 | |
// Create entry. | |
$entry_id = wpforms()->entry->add( array( | |
'form_id' => absint( $form_id ), | |
'user_id' => absint( $user_id ), | |
'fields' => wp_json_encode( $fields ), | |
'ip_address' => sanitize_text_field( $user_ip ), | |
'user_agent' => sanitize_text_field( $user_agent ), | |
'date' => $date, |
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( 'members_register_caps', 'cp_members_register_caps' ); | |
/** | |
* Register a custom capability in Members. | |
* | |
* @return void | |
*/ | |
function cp_members_register_caps() { | |
members_register_cap( 'capability_key', array( 'label' => 'Capability Label' ) ); |
NewerOlder