custom_elementor_admin_logo

function custom_admin_logo() { $image_url = get_site_url() . ‘/wp-content/uploads/2024/04/elementor.png’; // Make sure the path is correct echo ” “; } add_action(‘admin_head’, ‘custom_admin_logo’);Continue reading

Check for duplicate names 2 – click handler

add_action(‘admin_footer’, ‘duplicate_names_click_handler’); function duplicate_names_click_handler() { // Only add this script on the Users page to avoid unnecessary loading on other admin pages. $current_screen = get_current_screen(); if ($current_screen && ‘users’ === $current_screen->id) : ?>Continue reading

Check for duplicate names 1 – Admin notices – RUN ONCE

add_action(‘admin_notices’, ‘check_for_duplicate_full_names’); function check_for_duplicate_full_names() { $screen = get_current_screen(); // Check if we are on the Users page if ($screen->id !== ‘users’) { return; } global $wpdb; // SQL query to find duplicate first and last names $query = “SELECT meta_value…Continue reading

to do list working

/** * Plugin Name: Shop Manager To-Do List * Description: Adds a custom to-do list feature for shop managers in the WordPress admin. * Version: 1.0 * Author: Your Name */ // Register custom post type for To-Dos function create_todo_post_type()…Continue reading

Delete Expired Coupons

// Delete Expired Coupons that have an expiration date set and are not from AutomateWoo add_action(‘delete_expired_coupons_hook’, ‘delete_expired_coupons_action’); function delete_expired_coupons_action() { $query_args = [ ‘fields’ => ‘ids’, ‘post_type’ => ‘shop_coupon’, ‘post_status’ => ‘any’, ‘posts_per_page’ => -1, ‘orderby’ => ‘date’, ‘order’ =>…Continue reading

Add Featured Image Column

add_filter( ‘manage_posts_columns’, function ( $columns ) { // You can change this to any other position by changing ‘title’ to the name of the column you want to put it after. $move_after = ‘title’; $move_after_key = array_search( $move_after, array_keys( $columns…Continue reading

Add ID column in admin tables

add_action( ‘admin_init’, function () { // Get all public post types $post_types = get_post_types( array(), ‘names’ ); function wpcode_add_post_id_column( $columns ) { $columns[‘wpcode_post_id’] = ‘ID’; // ‘ID’ is the column title return $columns; } function wpcode_show_post_id_column_data( $column, $post_id ) {…Continue reading