Skip to content

Instantly share code, notes, and snippets.

View DeveloperWil's full-sized avatar

Wil Brown DeveloperWil

View GitHub Profile
@DeveloperWil
DeveloperWil / cwpdmb-redirect-to-custom-dashboard
Created May 21, 2025 06:55
Client WP Dashboard Makeover Blueprint: Redirect to Custom Dashboard
add_filter('login_redirect', function($r, $rq, $u) {
if (in_array('editor', $u->roles)) {
return admin_url('index.php?page=client-dashboard');
}
return $r;
}, 10, 3);
@DeveloperWil
DeveloperWil / cwpdmb-hide-plugin-theme-editor
Created May 21, 2025 06:52
Client WP Dashboard Makeover Blueprint: Hide Plugin & Theme Editor
define('DISALLOW_FILE_EDIT', true);
@DeveloperWil
DeveloperWil / cwpdmb-remove-default-dashboard-widgets
Created May 21, 2025 06:51
Client WP Dashboard Makeover Blueprint - Remove Default Dashboard Widgets
function remove_default_dashboard_widgets() {
remove_meta_box('dashboard_primary', 'dashboard', 'side');
remove_meta_box('dashboard_quick_press', 'dashboard', 'side');
remove_meta_box('dashboard_activity', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'remove_default_dashboard_widgets');
@DeveloperWil
DeveloperWil / cwpdmb-branded-login-screen
Created May 21, 2025 06:46
Client WP Dashboard Makeover Blueprint - Branded Login Screen
function my_login_logo() {
echo '<style>.login h1 a {
background-image: url(/path/to/logo.png);
background-size: contain;
width: 100%;
}</style>';
}
add_action('login_enqueue_scripts', 'my_login_logo');
@DeveloperWil
DeveloperWil / gravity-forms-australian-phone-numer-formats.php
Created March 7, 2023 02:24
Gravity Forms Australian Phone Number Formats
/**
* Provides specific formatting for Australian phone landlines and mobile numbers
*
* AU Mobile Format: XXXX XXX XXX
* Landline Mobile Format: XX XXXX XXXX
*
* @param $phone_formats
* @return mixed
*/
function zpd_gf_phone_formats_au( $phone_formats ){
@DeveloperWil
DeveloperWil / wp-add-js-script-to-footer.php
Last active October 20, 2022 02:32
WP Enqueue JavaScript editor.js file
@DeveloperWil
DeveloperWil / wilbrown-com-custom-login-page.php
Created May 11, 2022 03:00
WilBrown.com custom login page, two column, responsive
function wb_login_head(){
?>
<style>
#login{
width:50%;
float:left;
}
#wbd-login-left{
width:50%;
float: right;
@DeveloperWil
DeveloperWil / stripe-send-shipping-billing-address.php
Created November 15, 2021 23:05
Send shipping or billing address to Stripe transaction
/**
* Send shipping or billing details to Stripe (required by some 3DSecure transactions/currencies)
*
* @param $post_data
* @param $order
*
* @return mixed
*/
function zpd_add_shipping_to_stripe( $post_data, $order ) {
@DeveloperWil
DeveloperWil / gravity-forms-submission-to-amazon-echo.php
Created April 29, 2021 02:47
Gravity Forms: Form Submission to Amazon Echo
function gf_alexa_notification( $entry, $form ){
$notifyme_api_url = 'https://api.notifymyecho.com/v1/NotifyMe';
$notifyme_api_secret = '1234567890';
if( $form->ID === 12 ){
// Only for form ID=12
$firstname = rgar( $entry, '1.3' );
$lastname = rgar( $entry, '1.3' );
$phone = rgar( $entry, '2' );
$notification = $firstname . ' ' . $lastname . ' requested a callback on "' . $phone .'"';
@DeveloperWil
DeveloperWil / woocommerce-order-notification-to-amazon-echo.php
Last active April 29, 2021 02:46
WooCommerce: Order Notification to Amazon Echo
function zpd_wc_order_to_alexa( $payload, $resource, $resource_id, $id){
if( $id == 1) { // webhook ID is 1
// Get an instance of the WC_Order object (same as before)
$order = wc_get_order( $resource_id );
$payload[ 'accessCode' ] = ZPD_NOTIFYME_SECRET_API_KEY;
$payload[ 'notification'] = 'There is a new ' . $order->get_status() . ' order';
$payload[ 'notification'] .= ' on the ' . get_bloginfo( 'name' ) . ' website';
$payload[ 'notification'] .= ' from ' . $order->get_billing_first_name() . ' ' . $order->get_billing_last_name() . '.';
}