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
/** | |
* Remove PHP Dashboard Widget | |
*/ | |
function remove_site_wp_dashboard_widgets() { | |
remove_meta_box( 'dashboard_php_nag', 'dashboard', 'normal' ); | |
} | |
add_action( 'wp_dashboard_setup', 'remove_site_wp_dashboard_widgets' ); |
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
/** | |
* Remove Site Health Dashboard Widget | |
*/ | |
function remove_site_wp_dashboard_widgets() { | |
remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' ); | |
} | |
add_action( 'wp_dashboard_setup', 'remove_site_wp_dashboard_widgets' ); |
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 | |
/** | |
* Perform action/email when a WooCommerce order is placed on-hold | |
*/ | |
function wps_woocommerce_order_status_changed( $order_id, $checkout = null ) { | |
global $woocommerce; | |
$to = '[email protected]'; | |
$subject = ''; | |
$body = ''; | |
$headers = array('Content-Type: text/html; charset=UTF-8'); |
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 | |
/** | |
* Declare WooCommerce HPOS compatibility | |
*/ | |
function yourplugin_declare_hpos_compat() { | |
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { | |
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); | |
} | |
} | |
add_action( 'before_woocommerce_init', 'yourplugin_declare_hpos_compat' ); |
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 if inside WP Admin. Also works in the Block Editor. | |
* | |
* With the introduction of Gutenberg, is_admin() was broken. | |
* This better version will account for the Block Editor (Gutenberg) | |
*/ | |
function mytheme_better_is_admin() { | |
// Check if in Block Editor - see: https://github.com/WordPress/gutenberg/issues/51090#issuecomment-1576570247 | |
if ( is_admin() || ( defined( 'REST_REQUEST' ) && REST_REQUEST && 'edit' === $_GET['context'] ) ) { |
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
/** | |
* Change the default Login error message | |
*/ | |
function mytheme_login_error_msg() { | |
return 'Your username or password is incorrect.'; | |
} | |
add_filter( 'login_errors', 'mytheme_login_error_msg' ); |
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
/** | |
* Remove the Site Health Dashboard Widget | |
*/ | |
function ephemeris_remove_site_health_dashboard_widget() { | |
remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' ); | |
} | |
add_action( 'wp_dashboard_setup', 'ephemeris_remove_site_health_dashboard_widget' ); |
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 | |
/** | |
* If you have a child theme that has had its stylesheet enqueued from within the main Parent theme, | |
* and you wish to update the version number that’s appended to the url, you can include this in your | |
* child theme functions.php file. | |
* | |
* Obviously, change the version number (‘6.0.0’ in this example) to whatever is appropriate for you, | |
* along with comparing the approriate stylesheet handle ('ephemeris-style' in this example) | |
* | |
* Where: |
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 | |
/** | |
* Convert a phone number containing words, to a plain number. e.g. '1800 CALLME' == '1800225563' | |
*/ | |
function ephemeris_phone_word_to_number( $phone_number ) { | |
$phone_word_pattern = array( | |
'a' => '2', | |
'b' => '2', | |
'c' => '2', | |
'd' => '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 | |
/** | |
* Turn off WooCommerce Marketplace suggestions | |
*/ | |
add_filter( 'woocommerce_allow_marketplace_suggestions', '__return_false' ); | |
/** | |
* Turn off WooCommerce Feature Plugin notice | |
*/ | |
add_filter( 'woocommerce_show_admin_notice', '__return_false', 'wc_admin_feature_plugin_notice' ); |
NewerOlder