Changeset 2244629
- Timestamp:
- 02/14/2020 09:14:53 PM (6 years ago)
- Location:
- bulk-remove-posts-from-category
- Files:
-
- 8 added
- 3 edited
-
tags/3.0 (added)
-
tags/3.0/css (added)
-
tags/3.0/css/wpbulkremove_style.css (added)
-
tags/3.0/js (added)
-
tags/3.0/js/wpbulkremove.js (added)
-
tags/3.0/license.txt (added)
-
tags/3.0/readme.txt (added)
-
tags/3.0/wpbulkremove.php (added)
-
trunk/js/wpbulkremove.js (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/wpbulkremove.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bulk-remove-posts-from-category/trunk/js/wpbulkremove.js
r2047313 r2244629 7 7 8 8 jQuery(document).on('change', '#remcat input', function() { 9 var $bulktype = wpbulkremove.wpbulkremove_type; 10 if($bulktype == 'edit-post'){ 11 var $ini = 'post_category[]'; 12 } else { 13 var $ini = 'tax_input[product_cat][]'; 14 } 9 var $bulktype = wpbulkremove.wpbulkremove_type; 10 var $bulktax = wpbulkremove.wpbulkremove_tax; 11 if($bulktype == 'edit-post'){ 12 var $ini = 'post_category[]'; 13 } else if($bulktype == 'edit-product') { 14 var $ini = 'tax_input[product_cat][]'; 15 } else { 16 var $ini = 'tax_input['+$bulktax+'][]'; 17 } 15 18 var $repl = 'post_out_category'; 16 19 var $list = jQuery(this).closest('.inline-edit-col').find('ul.cat-checklist'); … … 35 38 36 39 var $bulktype = wpbulkremove.wpbulkremove_type; 40 var $bulktax = wpbulkremove.wpbulkremove_tax; 37 41 var bulk_edit_row = $( 'tr#bulk-edit' ); 38 42 remcat = bulk_edit_row.find( 'input[name="remove_cat"]' ).attr('checked') ? 1 : 0; … … 61 65 catout: catout, 62 66 remcat: remcat, 63 type: $bulktype 67 type: $bulktype, 68 taxonomy: $bulktax 64 69 } 65 70 }); -
bulk-remove-posts-from-category/trunk/readme.txt
r2212802 r2244629 4 4 Tags: post categories, bulk edit, bulk remove, product categories 5 5 Requires at least: 4.6 6 Tested up to: 5.3. 17 Stable tag: 2.16 Tested up to: 5.3.2 7 Stable tag: 3.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 19 19 This plugin extends default Bulk Editor so you can remove Categories from posts. 20 20 21 The plugin works just with default Post type and Woocommerce products.21 The plugin works just with default Post type, Woocommerce products and any other Custom Post Type. 22 22 23 23 == Installation == … … 34 34 = Does it work with custom post types = 35 35 36 Nope. This plugin doesn't supportCustom Post Types.36 Yes. This plugin works fine with Custom Post Types. 37 37 38 38 == Changelog == 39 40 = 3.0 = 41 * Custom Post Type support 39 42 40 43 = 2.1 = -
bulk-remove-posts-from-category/trunk/wpbulkremove.php
r2212802 r2244629 7 7 * Plugin URI: https://masterns-studio.com/code-factory/wordpress-plugin/bulk-remove-from-category/ 8 8 * Description: Bulk remove posts from category 9 * Version: 2.19 * Version: 3.0 10 10 * Author: MasterNs 11 11 * Author URI: https://masterns-studio.com/ 12 12 * License: GPLv2 or later 13 13 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 14 * Tested up to: 5.3. 114 * Tested up to: 5.3.2 15 15 * Text Domain: bulk-remove-posts-from-category 16 16 * Domain Path: languages/ … … 38 38 function wpbulkremove_enqueue($hook) { 39 39 $screen = get_current_screen(); 40 $can_run = false; 41 $cpt_tax = ''; 42 40 43 if (( 'edit-post' === $screen->id )||('edit-product' === $screen->id)) { 41 wp_enqueue_style('wpbulkremove_style', plugins_url('/css/wpbulkremove_style.css', __FILE__)); 42 wp_enqueue_script( 'wpbulkremove-js', plugins_url('/js/wpbulkremove.js', __FILE__)); 43 $wpbulkremove_array = array( 44 'wpbulkremove_string' => __( 'Remove from category', 'bulk-remove-posts-from-category' ), 45 'wpbulkremove_type' => $screen->id 46 ); 47 wp_localize_script( 'wpbulkremove-js', 'wpbulkremove', $wpbulkremove_array ); 48 } 44 $can_run = true; 45 } else { 46 $post_type = $screen->post_type; 47 $taxonomies = get_object_taxonomies($post_type, 'objects'); 48 foreach($taxonomies as $tax){ 49 if($tax->hierarchical){ 50 $can_run = true; 51 $cpt_tax = $tax->name; 52 } 53 } 54 } 55 56 if($can_run){ 57 wp_enqueue_style('wpbulkremove_style', plugins_url('/css/wpbulkremove_style.css', __FILE__)); 58 wp_enqueue_script( 'wpbulkremove-js', plugins_url('/js/wpbulkremove.js', __FILE__)); 59 $wpbulkremove_array = array( 60 'wpbulkremove_string' => __( 'Remove from category', 'bulk-remove-posts-from-category' ), 61 'wpbulkremove_type' => $screen->id, 62 'wpbulkremove_tax' => $cpt_tax 63 ); 64 wp_localize_script( 'wpbulkremove-js', 'wpbulkremove', $wpbulkremove_array ); 65 } 49 66 } 50 67 … … 67 84 if( $_POST[ 'type' ] == 'edit-post' ) { 68 85 $bulktax = 'category'; 86 } elseif($_POST[ 'type' ] == 'edit-product') { 87 $bulktax = 'product_cat'; 69 88 } else { 70 $bulktax = 'product_cat';89 $bulktax = $_POST[ 'taxonomy' ]; 71 90 } 72 91
Note: See TracChangeset
for help on using the changeset viewer.