Plugin Directory

Changeset 812995


Ignore:
Timestamp:
11/30/2013 08:34:42 PM (12 years ago)
Author:
randyjensen
Message:

support for custom post types added

Location:
rj-quick-empty-trash/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • rj-quick-empty-trash/trunk/RJQET_Plugin.php

    r807891 r812995  
    102102                    var data = {
    103103                        action: 'rjquet_custom_empty_trash_ajax',
    104                         type: 'comment'
     104                        type: t.data('pt')
    105105                    };
    106106
    107                     if (t.hasClass('post')) {
     107                    /*if (t.hasClass('post')) {
    108108                        data.type = 'post';
    109109                    } else if (t.hasClass('page'))
    110110                    {
    111111                        data.type = 'page';
    112                     }
     112                    }*/
    113113
    114114                    $.ajax('".admin_url()."admin-ajax.php', {
     
    129129        if ( array_key_exists( 'trash', $views ) )
    130130        {
    131             $type = ' comment';
    132             if (get_current_screen()->id === 'edit-page')
    133             {
    134                 $type = ' page';
    135             } else if (get_current_screen()->id === 'edit-post')
    136             {
    137                 $type = ' post';
     131            if (get_current_screen()->id == 'edit-comments') {
     132                $type = 'comment';
     133            } else {
     134                $type = get_current_screen()->post_type;
    138135            }
    139             $views['trash'] .= ' | <div id="rj_custom_empty_trash" class="button apply '.$type.'">Empty Trash</div>';
     136            $views['trash'] .= ' | &nbsp;<div id="rj_custom_empty_trash" class="button apply" data-pt="'.$type.'">Empty Trash</div> ';
    140137        }
    141138        return $views;
     
    153150        }
    154151        if ($hook_suffix == 'edit.php') {
    155             add_filter( 'views_edit-post', array( &$this, 'rjquet_custom_empty_trash_filter_menu' ) );
    156             add_filter( 'views_edit-page', array( &$this, 'rjquet_custom_empty_trash_filter_menu' ) );
     152            add_filter( 'views_edit-'.get_current_screen()->post_type, array( &$this, 'rjquet_custom_empty_trash_filter_menu' ) );
    157153        }
    158154    }
     
    178174            'post_status' => 'trash',
    179175            'numberposts' => -1,
    180             'post_type' => 'page'
     176            'post_type' => $_POST['type']
    181177        );
    182         if ($_POST['type'] == 'post') {
    183             $args['post_type'] = 'post';
    184         }
    185178
    186179        $trash = get_posts($args);
     
    189182        }
    190183
    191         if ($_POST['type'] == 'post') {
    192             die('Emptied trash for Posts');
    193         }
    194 
    195         if ($_POST['type'] == 'page') {
    196             die('Emptied trash for Pages');
    197         }
    198 
    199         die( 'Something doesn\'t seem right here.' );
     184        die('Emptied trash for '.$_POST['type']);
    200185    }
    201186
  • rj-quick-empty-trash/trunk/readme.txt

    r807891 r812995  
    66Requires at least: 3.5
    77Tested up to: 3.7.1
    8 Stable tag: 0.0.1
     8Stable tag: 0.0.2
    99
    1010Easier access to empty the trash for Comments, Posts and Pages
     
    3232== Changelog ==
    3333
     34= 0.2 =
     35- Added more spacing to nav item to better fit the WordPress style
     36- Added support for Custom Post Types
     37
    3438= 0.1 =
    3539- Initial Revision
  • rj-quick-empty-trash/trunk/rj-quick-empty-trash.php

    r807891 r812995  
    33   Plugin Name: RJ Quick Empty Trash
    44   Plugin URI: http://wordpress.org/extend/plugins/rj-quick-empty-trash/
    5    Version: 0.0.1
     5   Version: 0.0.2
    66   Author: Randy Jensen
    77   Description: Easier access to empty the trash for Posts, Pages and Comments
Note: See TracChangeset for help on using the changeset viewer.