Changeset 3692265
- Timestamp:
- 09/12/2026 02:05:39 AM (2 months ago)
- Location:
- bulk-menu-reorder
- Files:
-
- 10 edited
- 1 copied
-
tags/1.0.1 (copied) (copied from bulk-menu-reorder/trunk )
-
tags/1.0.1/assets/css/bulk-menu-reorder.css (modified) (1 diff)
-
tags/1.0.1/assets/js/bulk-menu-reorder.js (modified) (2 diffs)
-
tags/1.0.1/bulk-menu-reorder.php (modified) (2 diffs)
-
tags/1.0.1/includes/class-bulk-menu-reorder.php (modified) (3 diffs)
-
tags/1.0.1/readme.txt (modified) (4 diffs)
-
trunk/assets/css/bulk-menu-reorder.css (modified) (1 diff)
-
trunk/assets/js/bulk-menu-reorder.js (modified) (2 diffs)
-
trunk/bulk-menu-reorder.php (modified) (2 diffs)
-
trunk/includes/class-bulk-menu-reorder.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bulk-menu-reorder/tags/1.0.1/assets/css/bulk-menu-reorder.css
r3499574 r3692265 7 7 .menu-item.selected { 8 8 background-color: #f0f6fc; 9 } 10 11 .bmrr-select-item { 12 display: inline-flex; 13 align-items: center; 14 gap: 4px; 15 margin-right: 10px; 16 color: #50575e; 17 font-size: 12px; 18 font-weight: 400; 19 } 20 21 .bmrr-select-item input { 22 margin: 0; 9 23 } 10 24 -
bulk-menu-reorder/tags/1.0.1/assets/js/bulk-menu-reorder.js
r3499574 r3692265 5 5 init: function() { 6 6 this.menuList = $('#menu-to-edit'); 7 if (!this.menuList.length) { 8 return; 9 } 10 this.addSelectionControls(); 7 11 this.bindEvents(); 8 12 this.initSortable(); 9 13 }, 10 14 15 addSelectionControls: function() { 16 this.menuList.find('> .menu-item').each(function() { 17 const item = $(this); 18 const itemId = item.find('.menu-item-data-db-id').val(); 19 20 if (!item.find('.bmrr-menu-item-checkbox').length) { 21 item.find('.item-controls').prepend( 22 '<label class="bmrr-select-item" title="Select this item for bulk reordering">' + 23 '<input type="checkbox" class="bmrr-menu-item-checkbox" aria-label="Select menu item ' + itemId + '">' + 24 '<span>Select</span></label>' 25 ); 26 } 27 }); 28 }, 29 11 30 bindEvents: function() { 12 31 // Extend existing WordPress menu item selection 13 $(document).on('click', '.menu-item-checkbox', function() { 32 $(document).on('click', '.bmrr-menu-item-checkbox', function(e) { 33 e.stopPropagation(); 14 34 const menuItem = $(this).closest('.menu-item'); 15 menuItem.toggleClass('selected' );35 menuItem.toggleClass('selected', this.checked); 16 36 }); 17 37 }, … … 152 172 153 173 $.ajax({ 154 url: b ulkMenuReorder.ajaxUrl,174 url: bmrrBulkMenuReorder.ajaxUrl, 155 175 method: 'POST', 156 176 data: { 157 action: 'b ulk_reorder_menu_items',158 nonce: b ulkMenuReorder.nonce,177 action: 'bmrr_bulk_reorder_menu_items', 178 nonce: bmrrBulkMenuReorder.nonce, 159 179 menu_id: menuId, 160 menu_data: menuData180 menu_data: JSON.stringify(menuData) 161 181 }, 162 182 success: function(response) { -
bulk-menu-reorder/tags/1.0.1/bulk-menu-reorder.php
r3499574 r3692265 1 1 <?php 2 2 /** 3 * Plugin Name: Bulk Menu Reorder 4 * Description: Enables bulk reordering of menu items in WordPress navigation menus 5 * Version: 1.0.0 3 * Plugin Name: Bulk Navigation Menu Reorder 4 * Description: Reorder multiple WordPress navigation menu items using a simple drag-and-drop interface. 5 * Version: 1.0.1 6 * Requires at least: 6.0 7 * Requires PHP: 7.4 6 8 * Author: ATTN Studio 7 9 * License: GPL v2 or later … … 13 15 14 16 // Define plugin constants 15 define('BMRR_PLUGIN_VERSION', '1.0. 0');17 define('BMRR_PLUGIN_VERSION', '1.0.1'); 16 18 define('BMRR_PLUGIN_DIR', plugin_dir_path(__FILE__)); 17 19 define('BMRR_PLUGIN_URL', plugin_dir_url(__FILE__)); -
bulk-menu-reorder/tags/1.0.1/includes/class-bulk-menu-reorder.php
r3499574 r3692265 39 39 40 40 // Sanitize and unslash the input 41 $menu_data_raw = isset($_POST['menu_data']) ? sanitize_text_field(wp_unslash($_POST['menu_data'])) : '';41 $menu_data_raw = isset($_POST['menu_data']) ? wp_unslash($_POST['menu_data']) : ''; 42 42 43 43 // Decode the JSON data … … 48 48 wp_send_json_error('Invalid data format'); 49 49 } 50 51 $menu_id = isset($_POST['menu_id']) ? absint($_POST['menu_id']) : 0; 52 $menu = wp_get_nav_menu_object($menu_id); 53 54 if (!$menu) { 55 wp_send_json_error('Invalid menu'); 56 } 57 58 $allowed_item_ids = wp_list_pluck(wp_get_nav_menu_items($menu_id), 'ID'); 50 59 51 60 foreach ($menu_data as $position => $item) { … … 54 63 55 64 // Basic sanitization for item_id and parent_id 56 if ($item_id <= 0 || $parent_id < 0 ) {65 if ($item_id <= 0 || $parent_id < 0 || !in_array($item_id, $allowed_item_ids, true)) { 57 66 wp_send_json_error('Invalid menu item data'); 67 } 68 69 if ($parent_id > 0 && !in_array($parent_id, $allowed_item_ids, true)) { 70 wp_send_json_error('Invalid parent menu item'); 58 71 } 59 72 60 73 // Update menu item position and parent 61 update_post_meta($item_id, '_menu_item_menu_order', absint($position)); 74 wp_update_post(array( 75 'ID' => $item_id, 76 'menu_order' => absint($position) + 1, 77 )); 62 78 update_post_meta($item_id, '_menu_item_menu_item_parent', $parent_id); 63 79 } -
bulk-menu-reorder/tags/1.0.1/readme.txt
r3499578 r3692265 1 === Bulk Menu Reorder ===1 === Bulk Navigation Menu Reorder === 2 2 Contributors: hellosabrinamok 3 Tags: navigation menu, menu, menu order, reorder, bulk edit 3 4 Requires at least: 6.0 4 Tested up to: 6.85 Tested up to: 7.1 5 6 Requires PHP: 7.4 6 Stable tag: 1.0. 07 Stable tag: 1.0.1 7 8 License: GPLv2 or later 8 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 10 10 Bulk Menu Reorder enables bulk reordering of menu items in WordPress navigation menus, saving time and effort in menu management.11 Reorder multiple WordPress navigation menu items at once using a simple drag-and-drop interface built for large and nested menus. 11 12 12 13 == Description == 13 14 14 **Bulk Menu Reorder** simplifies the process of managing navigation menus in WordPress by allowing users to reorder multiple menu items at once. Designed for websites with complex menus, this plugin saves time and improves efficiency.15 Reordering a large WordPress navigation menu one item at a time can be slow and frustrating. 15 16 16 **Features:** 17 - Bulk reordering of menu items. 18 - Easy-to-use interface in the WordPress Admin Dashboard. 19 - Compatibility with most WordPress themes. 17 **Bulk Navigation Menu Reorder** adds a focused bulk-reordering interface to the standard WordPress menu editor. It helps administrators organize large navigation menus and nested menu structures more efficiently without changing the website's frontend design. 20 18 21 Whether you have a large e-commerce site or a blog with multiple menus, Bulk Menu Reorder helps you keep your navigation organized with ease. 19 **Key features:** 20 21 * Reorder multiple navigation menu items efficiently. 22 * Organize parent and child menu items with drag and drop. 23 * Work directly from Appearance > Menus. 24 * Load plugin assets only on the navigation menu screen. 25 * Make no changes to the website's frontend styling. 26 27 The plugin is especially useful for large websites, stores, directories, and content-heavy sites with complex navigation. 22 28 23 29 == Installation == … … 25 31 1. Upload the plugin files to the `/wp-content/plugins/bulk-menu-reorder` directory, or install the plugin through the WordPress Plugins screen directly. 26 32 2. Activate the plugin through the 'Plugins' screen in WordPress. 27 3. Navigate to **Appearance > Menus** to start reordering menu items. 33 3. Navigate to **Appearance > Menus** and select the menu you want to organize. 34 4. Use the bulk-reordering interface to arrange the items and save the new order. 28 35 29 36 == Frequently Asked Questions == 30 37 31 = Does this plugin work with all themes? = 32 Yes, the plugin works with any theme that supports WordPress navigation menus. 38 = Does this plugin change the appearance of my menu? = 33 39 34 = Can I undo changes made to my menu? = 35 Yes, changes to menu order can be undone by manually reordering items or restoring a previous backup. 40 No. It changes the order and hierarchy of navigation menu items but does not add frontend styles or alter your theme's menu design. 41 42 = Can I organize nested menu items? = 43 44 Yes. Menu items can be organized into parent and child relationships using the drag-and-drop interface. 45 46 = Who can reorder menus? = 47 48 Only users with permission to manage theme options and navigation menus can save changes. 36 49 37 50 = Does this plugin support multisite? = … … 40 53 == Screenshots == 41 54 42 1. **Bulk Reordering**: A preview of the bulk reorder functionality in themenu editor.55 1. Bulk-reordering interface in the WordPress navigation menu editor. 43 56 44 57 == Changelog == 58 59 = 1.0.1 = 60 * Fixed bulk reorder requests so menu changes save correctly. 61 * Added visible selection controls for choosing multiple menu items. 62 * Improved validation of menu items and parent relationships. 63 * Improved the plugin name, directory description, tags, and documentation. 45 64 46 65 = 1.0.0 = … … 49 68 == Upgrade Notice == 50 69 51 = 1.0. 0=52 I nitial release of Bulk Menu Reorder. Enjoy bulk reordering of your WordPress menu items.70 = 1.0.1 = 71 Improved directory information and documentation. 53 72 54 73 == License == -
bulk-menu-reorder/trunk/assets/css/bulk-menu-reorder.css
r3499574 r3692265 7 7 .menu-item.selected { 8 8 background-color: #f0f6fc; 9 } 10 11 .bmrr-select-item { 12 display: inline-flex; 13 align-items: center; 14 gap: 4px; 15 margin-right: 10px; 16 color: #50575e; 17 font-size: 12px; 18 font-weight: 400; 19 } 20 21 .bmrr-select-item input { 22 margin: 0; 9 23 } 10 24 -
bulk-menu-reorder/trunk/assets/js/bulk-menu-reorder.js
r3499574 r3692265 5 5 init: function() { 6 6 this.menuList = $('#menu-to-edit'); 7 if (!this.menuList.length) { 8 return; 9 } 10 this.addSelectionControls(); 7 11 this.bindEvents(); 8 12 this.initSortable(); 9 13 }, 10 14 15 addSelectionControls: function() { 16 this.menuList.find('> .menu-item').each(function() { 17 const item = $(this); 18 const itemId = item.find('.menu-item-data-db-id').val(); 19 20 if (!item.find('.bmrr-menu-item-checkbox').length) { 21 item.find('.item-controls').prepend( 22 '<label class="bmrr-select-item" title="Select this item for bulk reordering">' + 23 '<input type="checkbox" class="bmrr-menu-item-checkbox" aria-label="Select menu item ' + itemId + '">' + 24 '<span>Select</span></label>' 25 ); 26 } 27 }); 28 }, 29 11 30 bindEvents: function() { 12 31 // Extend existing WordPress menu item selection 13 $(document).on('click', '.menu-item-checkbox', function() { 32 $(document).on('click', '.bmrr-menu-item-checkbox', function(e) { 33 e.stopPropagation(); 14 34 const menuItem = $(this).closest('.menu-item'); 15 menuItem.toggleClass('selected' );35 menuItem.toggleClass('selected', this.checked); 16 36 }); 17 37 }, … … 152 172 153 173 $.ajax({ 154 url: b ulkMenuReorder.ajaxUrl,174 url: bmrrBulkMenuReorder.ajaxUrl, 155 175 method: 'POST', 156 176 data: { 157 action: 'b ulk_reorder_menu_items',158 nonce: b ulkMenuReorder.nonce,177 action: 'bmrr_bulk_reorder_menu_items', 178 nonce: bmrrBulkMenuReorder.nonce, 159 179 menu_id: menuId, 160 menu_data: menuData180 menu_data: JSON.stringify(menuData) 161 181 }, 162 182 success: function(response) { -
bulk-menu-reorder/trunk/bulk-menu-reorder.php
r3499574 r3692265 1 1 <?php 2 2 /** 3 * Plugin Name: Bulk Menu Reorder 4 * Description: Enables bulk reordering of menu items in WordPress navigation menus 5 * Version: 1.0.0 3 * Plugin Name: Bulk Navigation Menu Reorder 4 * Description: Reorder multiple WordPress navigation menu items using a simple drag-and-drop interface. 5 * Version: 1.0.1 6 * Requires at least: 6.0 7 * Requires PHP: 7.4 6 8 * Author: ATTN Studio 7 9 * License: GPL v2 or later … … 13 15 14 16 // Define plugin constants 15 define('BMRR_PLUGIN_VERSION', '1.0. 0');17 define('BMRR_PLUGIN_VERSION', '1.0.1'); 16 18 define('BMRR_PLUGIN_DIR', plugin_dir_path(__FILE__)); 17 19 define('BMRR_PLUGIN_URL', plugin_dir_url(__FILE__)); -
bulk-menu-reorder/trunk/includes/class-bulk-menu-reorder.php
r3499574 r3692265 39 39 40 40 // Sanitize and unslash the input 41 $menu_data_raw = isset($_POST['menu_data']) ? sanitize_text_field(wp_unslash($_POST['menu_data'])) : '';41 $menu_data_raw = isset($_POST['menu_data']) ? wp_unslash($_POST['menu_data']) : ''; 42 42 43 43 // Decode the JSON data … … 48 48 wp_send_json_error('Invalid data format'); 49 49 } 50 51 $menu_id = isset($_POST['menu_id']) ? absint($_POST['menu_id']) : 0; 52 $menu = wp_get_nav_menu_object($menu_id); 53 54 if (!$menu) { 55 wp_send_json_error('Invalid menu'); 56 } 57 58 $allowed_item_ids = wp_list_pluck(wp_get_nav_menu_items($menu_id), 'ID'); 50 59 51 60 foreach ($menu_data as $position => $item) { … … 54 63 55 64 // Basic sanitization for item_id and parent_id 56 if ($item_id <= 0 || $parent_id < 0 ) {65 if ($item_id <= 0 || $parent_id < 0 || !in_array($item_id, $allowed_item_ids, true)) { 57 66 wp_send_json_error('Invalid menu item data'); 67 } 68 69 if ($parent_id > 0 && !in_array($parent_id, $allowed_item_ids, true)) { 70 wp_send_json_error('Invalid parent menu item'); 58 71 } 59 72 60 73 // Update menu item position and parent 61 update_post_meta($item_id, '_menu_item_menu_order', absint($position)); 74 wp_update_post(array( 75 'ID' => $item_id, 76 'menu_order' => absint($position) + 1, 77 )); 62 78 update_post_meta($item_id, '_menu_item_menu_item_parent', $parent_id); 63 79 } -
bulk-menu-reorder/trunk/readme.txt
r3499578 r3692265 1 === Bulk Menu Reorder ===1 === Bulk Navigation Menu Reorder === 2 2 Contributors: hellosabrinamok 3 Tags: navigation menu, menu, menu order, reorder, bulk edit 3 4 Requires at least: 6.0 4 Tested up to: 6.85 Tested up to: 7.1 5 6 Requires PHP: 7.4 6 Stable tag: 1.0. 07 Stable tag: 1.0.1 7 8 License: GPLv2 or later 8 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 9 10 10 Bulk Menu Reorder enables bulk reordering of menu items in WordPress navigation menus, saving time and effort in menu management.11 Reorder multiple WordPress navigation menu items at once using a simple drag-and-drop interface built for large and nested menus. 11 12 12 13 == Description == 13 14 14 **Bulk Menu Reorder** simplifies the process of managing navigation menus in WordPress by allowing users to reorder multiple menu items at once. Designed for websites with complex menus, this plugin saves time and improves efficiency.15 Reordering a large WordPress navigation menu one item at a time can be slow and frustrating. 15 16 16 **Features:** 17 - Bulk reordering of menu items. 18 - Easy-to-use interface in the WordPress Admin Dashboard. 19 - Compatibility with most WordPress themes. 17 **Bulk Navigation Menu Reorder** adds a focused bulk-reordering interface to the standard WordPress menu editor. It helps administrators organize large navigation menus and nested menu structures more efficiently without changing the website's frontend design. 20 18 21 Whether you have a large e-commerce site or a blog with multiple menus, Bulk Menu Reorder helps you keep your navigation organized with ease. 19 **Key features:** 20 21 * Reorder multiple navigation menu items efficiently. 22 * Organize parent and child menu items with drag and drop. 23 * Work directly from Appearance > Menus. 24 * Load plugin assets only on the navigation menu screen. 25 * Make no changes to the website's frontend styling. 26 27 The plugin is especially useful for large websites, stores, directories, and content-heavy sites with complex navigation. 22 28 23 29 == Installation == … … 25 31 1. Upload the plugin files to the `/wp-content/plugins/bulk-menu-reorder` directory, or install the plugin through the WordPress Plugins screen directly. 26 32 2. Activate the plugin through the 'Plugins' screen in WordPress. 27 3. Navigate to **Appearance > Menus** to start reordering menu items. 33 3. Navigate to **Appearance > Menus** and select the menu you want to organize. 34 4. Use the bulk-reordering interface to arrange the items and save the new order. 28 35 29 36 == Frequently Asked Questions == 30 37 31 = Does this plugin work with all themes? = 32 Yes, the plugin works with any theme that supports WordPress navigation menus. 38 = Does this plugin change the appearance of my menu? = 33 39 34 = Can I undo changes made to my menu? = 35 Yes, changes to menu order can be undone by manually reordering items or restoring a previous backup. 40 No. It changes the order and hierarchy of navigation menu items but does not add frontend styles or alter your theme's menu design. 41 42 = Can I organize nested menu items? = 43 44 Yes. Menu items can be organized into parent and child relationships using the drag-and-drop interface. 45 46 = Who can reorder menus? = 47 48 Only users with permission to manage theme options and navigation menus can save changes. 36 49 37 50 = Does this plugin support multisite? = … … 40 53 == Screenshots == 41 54 42 1. **Bulk Reordering**: A preview of the bulk reorder functionality in themenu editor.55 1. Bulk-reordering interface in the WordPress navigation menu editor. 43 56 44 57 == Changelog == 58 59 = 1.0.1 = 60 * Fixed bulk reorder requests so menu changes save correctly. 61 * Added visible selection controls for choosing multiple menu items. 62 * Improved validation of menu items and parent relationships. 63 * Improved the plugin name, directory description, tags, and documentation. 45 64 46 65 = 1.0.0 = … … 49 68 == Upgrade Notice == 50 69 51 = 1.0. 0=52 I nitial release of Bulk Menu Reorder. Enjoy bulk reordering of your WordPress menu items.70 = 1.0.1 = 71 Improved directory information and documentation. 53 72 54 73 == License ==
Note:
See TracChangeset
for help on using the changeset viewer.