Add a Remove button (w/ code)
-
hello! We modified the plugin to add a Remove button to each item in the post order list.
posts_order.php
line 287 add
if ( isset( $_POST['removesingle'] ) ) { foreach($_POST['removesingle'] as $order=>$post_id) { $meta_key = '_sort_' . $this->term_id; wp_remove_object_terms( $post_id, intval($this->term_id), $this->taxonomy ); delete_post_meta( $post_id, $meta_key ); } }
line 334-336 update to
<li style="margin: 0; background: #FFF; padding: 8px 8px; border-bottom: 1px solid #EEE; cursor:move;" id="sorthandle-<?php the_ID();?>"> <input type="hidden" name="sort[]" value="<?php the_ID(); ?>" />[<?php echo $order; ?>] <?php the_title(); ?> [<?php echo get_the_date("Y-m-d"); ?>] (<?php echo get_post_status(); ?>) <span style="float: right;cursor: pointer;color: red;" onClick="jQuery('#sorthandle-<?php the_ID();?>').hide();jQuery('#sorthandle-<?php the_ID();?> input').attr('name','removesingle[]')"> Remove</span> </li>
You are welcome to integrate this into the plugin.
- The topic ‘Add a Remove button (w/ code)’ is closed to new replies.