Plugin Directory

Changeset 903009


Ignore:
Timestamp:
04/26/2014 05:17:00 AM (12 years ago)
Author:
eflyjason
Message:

Fix Bugs

Location:
autoset-featured-image/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • autoset-featured-image/trunk/autoset-featured-image.php

    r903003 r903009  
    77Plugin URI:   http://www.arefly.com/autoset-featured-image/
    88Description:  Auto Set the first image of your post to Featured Image.
    9 Version:      1.1.1
     9Version:      1.1.2
    1010Author:       Arefly
    1111Author URI:   http://www.arefly.com/
     
    5252add_action('pending_to_publish', 'autoset_featured_image');
    5353add_action('future_to_publish', 'autoset_featured_image');
    54 
    55 function autoset_featured_image_for_old_posts(){
    56     $all_posts = get_posts(array('numberposts' => 9999));
    57     foreach($all_posts as $k => $v){
    58         $args = array(
    59             'numberposts' => 1,
    60             'order'=> 'ASC',
    61             'post_mime_type' => 'image',
    62             'post_parent' => $v->ID,
    63             'post_type' => 'attachment'
    64         );
    65         $attachments = get_children($args);
    66         $i = 0;
    67         foreach($attachments as $attach){
    68             if($i == 0)
    69                 $attachmentsid = $attach->ID;
    70             $i++;
    71         }
    72         set_post_thumbnail($v->ID, $attachmentsid);
    73     }
    74 }
    75 add_action('admin_init', 'autoset_featured_image_for_old_posts');
  • autoset-featured-image/trunk/readme.txt

    r903003 r903009  
    6363== Changelog ==
    6464
     65**Version 1.1.2**
     66
     67* Fix Bugs.
     68
    6569**Version 1.1.1**
    6670
     
    7074
    7175* Support WordPress 3.9.
    72 
    73 * Now the plugin will auto set the Featured Image of old posts!
    7476
    7577**Version 1.0.8 to 1.0.9**
Note: See TracChangeset for help on using the changeset viewer.