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 | |
/** | |
* WooCommerce settings page | |
* | |
* This code creates a full WooCommerce settings page by extending the WC_Settings_Page class. | |
* By extending the WC_Settings_Page class, we can control every part of the settings page. | |
* | |
* @author Ren Ventura <renventura.com> | |
*/ |
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
<?php | |
add_filter( 'mepr_fetch_options', 'mp_filter_custom_fields' ); | |
/** | |
* Filter the MemberPress options to set a dynamic value for custom fields. | |
* | |
* @param object $options MeprOptions | |
* | |
* @return object MeprOptions | |
*/ |
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 //* Mind this opening PHP tag | |
// Remove the logout link in comment form | |
add_filter( 'comment_form_logged_in', '__return_empty_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 | |
// 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 //* Mind this opening php tag | |
/** | |
* This will hide the Divi "Project" post type. | |
* Thanks to georgiee (https://gist.github.com/EngageWP/062edef103469b1177bc#gistcomment-1801080) for his improved solution. | |
*/ | |
add_filter( 'et_project_posttype_args', 'mytheme_et_project_posttype_args', 10, 1 ); | |
function mytheme_et_project_posttype_args( $args ) { | |
return array_merge( $args, array( | |
'public' => false, |
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 //* mind this opening php tag | |
/** | |
* This snippet returns a list of all currently hooked functions. | |
* It is set up to output this data on a specific page. Do not output this data publicly. | |
* Use this snippet for debugging/testing/development. | |
* Source: http://www.rarst.net/wordpress/debug-wordpress-hooks/ | |
* Modified by Ren Ventura, EngageWP.com | |
**/ |
NewerOlder