Automatically Set Image Title & Alt-Text upon upload

/* Automatically set the image Title & Alt-Text upon upload*/ add_action( ‘add_attachment’, ‘my_set_image_meta_upon_image_upload’ ); function my_set_image_meta_upon_image_upload( $post_ID ) { // Check if uploaded file is an image, else do nothing if ( wp_attachment_is_image( $post_ID ) ) { $my_image_title = get_post(…Continue reading

Sort Pages & Posts by Date in WP Dashboard

function set_post_order_in_admin($wp_query) { global $pagenow; if (is_admin() && ‘edit.php’ == $pagenow && !isset($_GET[‘orderby’])) { $wp_query->set(‘orderby’, ‘date’); $wp_query->set(‘order’, ‘DESC’); } } add_filter(‘pre_get_posts’, ‘set_post_order_in_admin’);Continue reading

Admin Footer Klovera Support Link

/** * Klovera Admin UI – Global * – Remove WooCommerce rating / marketing notices * – Replace admin footer with Klovera support message * – Optional: hide WordPress version text */ /** * 1) Remove WooCommerce admin notices (rating,…Continue reading

Hide Admin Notices for Non-Admins

/** * Hide admin notices for non-admin roles */ add_action(‘admin_init’, function () { if (!current_user_can(‘administrator’)) { remove_all_actions(‘admin_notices’); remove_all_actions(‘all_admin_notices’); } });Continue reading

Side Menu

/** * Print Portals – Left Sidebar Menu (v3) * * – Shows for ALL users. * – Orders + Address Book: * – Logged out => /login * – Logged in => /orders, /address-book * – Bottom button: *…Continue reading

Orders Page & Approvals

/** * Your Orders (AJAX Grid + Viewer) + Optional Approvals + Custom Emails + Custom Thank You * + Friendly /orders/{order-number} + AJAX pagination (50 per page) with NO page refresh * * Shortcodes: * [your_orders] * * IMPORTANT:…Continue reading

Enqueue Scrips !important

add_action( ‘wp_enqueue_scripts’, function() { // 1) Make sure WooCommerce’s checkout.js is loaded (so it will set up wc_checkout_params) if ( ! wp_script_is( ‘wc-checkout’, ‘enqueued’ ) ) { wp_enqueue_script( ‘wc-checkout’ ); } // 2) Then load *your* script *after* it, so…Continue reading