code

Cropper js usage

Here’s how to implement Cropper.js with a tile-triggered modal upload in WordPress, using Bootstrap for the modal (which works well with Cropper.js controls): 1. Enqueue Required Scripts & Styles 2. Create the Tile + Modal HTML (Shortcode) 3. JavaScript (custom-cropper.js) 4. PHP AJAX Handler (in functions.php) Why Bootstrap Modal Works Well Alternative Approach If you don’t want Bootstrap, use WordPress’s native wp_enqueue_media() + a <dialog> element, but

Cropper js usage Read More »

Hooks Reference Backend

1. Early Initialization (Before Admin UI Loads) These hooks fire before the admin interface is rendered: 2. Admin-Specific Setup Hooks for admin dashboard initialization: 3. Admin UI Rendering Hooks during page rendering: 4. Post/Page Editing Hooks specific to post-editing screens: 5. Late-Stage & Cleanup Key Admin-Only Hooks Cheatsheet Hook Purpose Example Use Case admin_init Initialize

Hooks Reference Backend Read More »

Hooks Ref Frontend

Here’s a cheatsheet of WordPress frontend action hooks in the approximate order they fire during a typical page load. This will help you understand the execution flow and where to inject your custom code. 1. Before WordPress Initializes These hooks fire very early, before most of WordPress is loaded. 2. Template Processing Hooks related to template loading

Hooks Ref Frontend Read More »

WP List Table

WP_List_Table Core Reference 19 1. Key Methods to Override Method Purpose prepare_items() Fetch/paginate/sort data (required) get_columns() Define table columns (required) column_default() Render content for columns without custom methods column_{name}() Custom output for specific columns (e.g., column_title()) get_sortable_columns() Define which columns are sortable get_bulk_actions() Add bulk actions (e.g., “Delete”, “Export”) 2. Essential Properties Property Description $items Array of

WP List Table Read More »

Admin Conditionals

Basic Admin Detection Check Specific Admin Pages 📋 Post Editor Conditions Post Type Editor Gutenberg vs Classic Editor 🗂️ List Table Screens Post List Table ⚙️ Special Admin Pages Plugin/Theme Admin Pages User Profile Screen 🛡️ Advanced Conditional Checks Combined with Hook Suffixes Checking Admin AJAX Requests Admin Area with GET/POST Parameters

Admin Conditionals Read More »

Admin Hooks

Core Admin Hooks 🖥️ Page-Specific Hooks 📝 Post/Editor Hooks 🗃️ List Table Hooks ⚙️ User & Dashboard Hooks 🛠️ Advanced Power Hooks 🎯 When to Use Which Hook? Scenario Recommended Hook Adding a settings page admin_menu Saving post meta save_post Modifying post columns manage_{type}_posts_columns Adding help tabs load-{page} Admin notices admin_notices Custom admin AJAX wp_ajax_{action} 💡 Pro Tips

Admin Hooks Read More »