How to get it working with custom post types?
-
Unfortunately this plugin doesn’t appear with custom post types. Is there any solution to get it working together with it? Maybe via the function create_post_type()?
Thanks in advance,
benraaa
-
I also desperately need functionality like this, for custom post types and custom taxonomies assigned to the custom post types. Your plugin is soooo close to what I need! if you need anyone to test a revised plugin that has this feature, I’d be willing to try it out.
Next week I will look to it, and see if I can implement what you ask.
Can you specify what exactly is the problem.
Post (Post Type: ‘post’)
Page (Post Type: ‘page’)
Attachment (Post Type: ‘attachment’)
Revision (Post Type: ‘revision’)
Navigation menu (Post Type: ‘nav_menu_item’)Are this the post types you want?
Is it necessary that post types can be changed?
Or just the category where it should belongs to?Hello,
These functions would be very useful for WooCommerce products. Please add support if you can ??
Thanks!
If you want to get it to work with woocommerce:
1. In batchmove/batch_admin.php, before $posts = $query->query($q); add:
/*selecting also 'product' post_types */ function filter_where_woo($where = '') { global $bm; $where .= ' OR post_type = "product" '; return $where; } $filter = add_filter('posts_where', 'filter_where_woo');
2. in batchmove/include/functions.php
a) replace the whole ‘switch’ at line 21 with:switch ($apost['act-cats']) { case "add": foreach ((array) $apost['ids'] as $id) { $id = intval($id); wp_set_post_terms($id, array(intval($cat)), 'product_cat',true); } break; case 'upd': foreach ((array) $apost['ids'] as $id) { $new = array(); $new[] = intval($cat); wp_set_post_terms($id, (array) $new, 'product_cat'); } break; case 'del': foreach ((array) $apost['ids'] as $id) { $id = intval($id); wp_remove_object_terms( $id, intval($cat), 'product_cat' ); } break; default: ; } // switch
b) in function show_bm_selector:
replace the line$html .= wp_dropdown_categories('hide_empty=0&hierarchical=1&echo=0&selected=' . ( isset($_REQUEST['cat']) ? intval($_REQUEST['cat']) : -1 ));
with
$html .= wp_dropdown_categories('hide_empty=0&hierarchical=1&echo=0&taxonomy=product_cat&selected=' . ( isset($_REQUEST['cat']) ? intval($_REQUEST['cat']) : -1 ));
c) in function show_bm_actions:
replace the line$html .= wp_dropdown_categories('name=qcat&hide_empty=0&hierarchical=1&echo=0' );
with
$html .= wp_dropdown_categories('name=qcat&hide_empty=0&hierarchical=1&echo=0&taxonomy=product_cat' );
d) in function get_results
replace the line$categories = wp_get_post_categories($post->ID);
with
$categories = wp_get_post_terms($post->ID,'product_cat');
You should make a backup of the 2 files first. Good Luck!
Disregard my previous post – someone should delete it.
If you want to get it to work with woocommerce:
1. In batchmove/batch_admin.php, comment out line:
if ($bm->cat == "") {return;}
2. in batchmove/include/functions.php
a) replace the whole ‘switch’ at line 21 with:switch ($apost['act-cats']) { case "add": foreach ((array) $apost['ids'] as $id) { $id = intval($id); wp_set_post_terms($id, array(intval($cat)), 'product_cat',true); } break; case 'upd': foreach ((array) $apost['ids'] as $id) { $new = array(); $new[] = intval($cat); wp_set_post_terms($id, (array) $new, 'product_cat'); } break; case 'del': foreach ((array) $apost['ids'] as $id) { $id = intval($id); wp_remove_object_terms( $id, intval($cat), 'product_cat' ); } break; default: ; } // switch
b) in function show_bm_selector:
replace the line$html .= wp_dropdown_categories('hide_empty=0&hierarchical=1&echo=0&selected=' . ( isset($_REQUEST['cat']) ? intval($_REQUEST['cat']) : -1 ));
with
$html .= wp_dropdown_categories('hide_empty=0&hierarchical=1&echo=0&taxonomy=product_cat&selected=' . ( isset($_REQUEST['cat']) ? intval($_REQUEST['cat']) : -1 ));
c) in function show_bm_actions:
replace the line$html .= wp_dropdown_categories('name=qcat&hide_empty=0&hierarchical=1&echo=0' );
with
$html .= wp_dropdown_categories('name=qcat&hide_empty=0&hierarchical=1&echo=0&taxonomy=product_cat' );
d) in function get_results
replace the line$categories = wp_get_post_categories($post->ID);
with
$categories = wp_get_post_terms($post->ID,'product_cat');
e) in function get_a_query
Replace
$qa = array( 'paged' => $bm->paged, 'posts_per_page' => $bm->per_page, 'orderby' => $bm->orderby, 'order' => $bm->order);
with
$gets = $bm->get; $cat = (empty($gets['cat']))?$gets['qcat']:$gets['cat']; if ($cat) { $qa['cat'] = intval($cat); } $qa = array( 'paged' => $bm->paged, 'posts_per_page' => $bm->per_page, 'orderby' => $bm->orderby, 'order' => $bm->order, 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'field' => 'term_id', 'terms' => intval($cat) ) ) );
You should make a backup of the 2 files first. Good Luck!
We did implemented the changes which are proposed by gigiwordpress
Sorry, It did not workOur customers also requesting this functionality.
In near future we will implement the use of Woocommerce categories.CS
How can I use your plugin with pages ? I have pages which are sorted in categories. How can I quickly change the post-type from posts to pages ?
Thanks for your help!hi zauberer,
have you found a solution yet ?
- The topic ‘How to get it working with custom post types?’ is closed to new replies.