Plugin Directory

Changeset 478283


Ignore:
Timestamp:
12/20/2011 11:43:08 PM (14 years ago)
Author:
kilinkis
Message:

Added date and qty of attached images columns. Date being sortable.

Location:
attached-images-title-editor/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • attached-images-title-editor/trunk/attached_images_title_editor.php

    r477822 r478283  
    3131            case 'name':
    3232            case 'post_title':
     33        case 'post_date':
    3334                return $item[$column_name];
    3435            default:
     
    5657    }
    5758
    58     function column_cb($item){
    59         return sprintf(
    60             '<input type="checkbox" name="%1$s[]" value="%2$s" />',
    61             /*$1%s*/ $this->_args['singular'],  //Let's simply repurpose the table's singular label ("image")
    62             /*$2%s*/ $item['ID']                //The value of the checkbox should be the record's id
    63         );
    64     }
     59    function column_date($item) {
     60        $date = sprintf('%s',$item['post_date']);
     61        return $date;
     62    }
     63
     64    function column_qty($item) {
     65        $qty = sprintf('%s',$item['attached']);
     66        return $qty;
     67    }
     68
     69    //function column_cb($item){
     70      //  return sprintf(
     71        //    '<input type="checkbox" name="%1$s[]" value="%2$s" />',
     72            /*$1%s*/ //$this->_args['singular'],  //Let's simply repurpose the table's singular label ("image")
     73            /*$2%s*/ //$item['ID']                //The value of the checkbox should be the record's id
     74        //);
     75    //}
    6576   
    6677    function get_columns(){
    6778    $columns = array(
    68         'post_title'     => 'Title',
    69         'name'    => 'Category',
    70         'tx'        => 'New title'
     79        'post_title' => 'Title',
     80        'name'       => 'Category',
     81        'date'       => 'Date',
     82        'qty'        => 'Attached images',
     83        'tx'         => 'New title'
    7184        );
    7285        return $columns;
     
    7588    function get_sortable_columns() {
    7689        $sortable_columns = array(
    77             'post_title'     => array('post_title',true),     //true means its already sorted
    78             'name'  => array('name',false)
     90            'post_title' => array('post_title',true),     //true means its already sorted
     91            'name'  => array('name',false),
     92        'date'  => array('post_date',false)
    7993        );
    8094        return $sortable_columns;
     
    94108            global $wpdb;
    95109            global $post;
    96             $querystr = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->terms.name
    97                          FROM $wpdb->posts
    98                          LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id)
    99                          LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)
    100                          LEFT JOIN $wpdb->terms ON($wpdb->terms.term_id = $wpdb->term_taxonomy.term_id)
    101                          WHERE  $wpdb->posts.post_type = '$tipo'
    102                          AND $wpdb->posts.post_status='publish'
     110
     111            $querystr = "SELECT p.ID, p.post_title, p.post_date, wp_terms.name, (SELECT COUNT(pp.ID) FROM wp_posts pp WHERE pp.post_type = 'attachment' AND pp.post_parent = p.ID) as attached
     112                         FROM wp_posts p
     113                         LEFT JOIN wp_term_relationships ON (p.ID =wp_term_relationships.object_id)
     114                         LEFT JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)
     115                         LEFT JOIN wp_terms ON(wp_terms.term_id =wp_term_taxonomy.term_id)
     116                         WHERE p.post_status='publish'
    103117                        ";
    104118            if ($tipo == 'post') { $querystr = $querystr." AND $wpdb->term_taxonomy.taxonomy = 'category'"; }
  • attached-images-title-editor/trunk/readme.txt

    r477822 r478283  
    55Requires at least: 3
    66Tested up to: 3.3
    7 Stable tag: 1
     7Stable tag: 1.1
    88
    99This plugin has the hability to change the title of all the images attached to a post by inserting a new title for them all.
     
    4545== Upgrade Notice ==
    4646
    47 = 1.0 =
    48 This is a fully working version.
     47= 1.1 =
     48*Added sortable date column.
     49*Added quantity of images attached column
  • attached-images-title-editor/trunk/style.css

    r477822 r478283  
    55    float:right;
    66    }
    7 #filter input {
    8     margin-right:5px;
    9     }
    107.checkmark {
    118    margin-left:5px;
    129    margin-right:5px;
    1310    }
     11#post_title { width:30%; }
     12#name { width:20%; }
     13#date { width:150px; }
     14#qty { width:80px; }
     15.column-qty { text-align:center; }
     16#tx { width:30%; }
     17.new_desc { width:50%; margin-right:5px; }
Note: See TracChangeset for help on using the changeset viewer.