Plugin Directory

Changeset 1878326


Ignore:
Timestamp:
05/21/2018 10:39:30 AM (8 years ago)
Author:
sanny_rss
Message:

Fresh

Location:
wp-auto-featured-image
Files:
9 added
5 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • wp-auto-featured-image/trunk/js/wafi-script.js

    r1416128 r1878326  
    1515    });
    1616   
    17     jQuery('#upload_default_thumb').click(function() {     
    18         upload_field_ID = jQuery(this).prev('input');
    19         form_field      = jQuery('#default_thumb_url').attr( 'name' );
    20         tb_show('Upload Thumb', 'media-upload.php?referer=wp_afi&type=image&TB_iframe=true&post_id=0', false);
    21         return false;
     17    //jQuery('#upload_default_thumb').click(function(e) {   
     18    jQuery(document).on("click", "#upload_default_thumb", function (e) {
     19
     20    // Removed 21 May 2018 
     21        // upload_field_ID = jQuery(this).prev('input');
     22        // form_field      = jQuery('#default_thumb_url').attr( 'name' );
     23        // tb_show('Upload Thumb', 'media-upload.php?referer=wp_afi&type=image&TB_iframe=true&post_id=0', false);
     24        // return false;
     25    // Added 21 May 2018
     26        e.preventDefault();
     27        var file_frame = wp.media.frames.file_frame = wp.media({
     28            title: 'Select or upload image',
     29            library: { // remove these to show all
     30            type: 'image' // specific mime
     31            },
     32            button: {
     33            text: 'Set This My Default Thumbnail'
     34            },
     35            multiple: false  // Set to true to allow multiple files to be selected
     36        });
     37
     38
     39        // When an image is selected, run a callback.
     40        file_frame.on('select', function () {
     41         // We set multiple to false so only get one image from the uploader
     42
     43         var attachment = file_frame.state().get('selection').first().toJSON();     
     44        jQuery('#default_thumb_url').val(attachment.url);
     45        jQuery('#default_thumb_id').val(attachment.id);     
     46        jQuery('#uploaded_thumb_preview img').attr('src',attachment.url);
     47        jQuery('.button-primary').click();
     48
     49         //$button.siblings('input').val(attachment.url).change();
     50
     51        });
     52
     53        // Finally, open the modal
     54        file_frame.open();
     55
    2256    });
    2357   
     58    /*
     59 Removed 21 May 2018
    2460    window.send_to_editor = function(html) {
    2561        if (form_field) {
     
    4379        jQuery('#uploaded_thumb_preview img').attr('src',image_url);
    4480        jQuery('.button-primary').click();
    45     }   
     81    }   */
    4682   
    4783   
  • wp-auto-featured-image/trunk/readme.txt

    r1410827 r1878326  
    33Tags: Featured Image, Auto Featured Image, Default Featured Image, Auto, Default, Post Thumbnail, Auto Post Thumbnail, Set Post Thumbnail, Auto Post Thumbnail, WordPress Post Thumbnail
    44Donate link: https://sannysrivastava.wordpress.com
    5 Requires at least: 3.0
    6 Tested up to: 4.5.1
    7 Stable tag: 1.4
     5Requires at least: 3.5
     6Tested up to: 4.9.5
     7Stable tag: 1.5
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3838== Frequently Asked Questions ==
    3939
    40 = Will this auto set thumbnail for all existing posts/pages? =
     40= This plugin will set default thumbnail for all existing post-types/pages? =
    4141
    42 This wil work for the post types you have configured from admin, it will work for newly cretaed or modified posts after your configuration from admin panel.
     42This wil work for the post types you have configured from admin, it will work only for new or modified post-types/pages as per your configuration from admin panel.
    4343
    44 = Can I choose specific post type for this? =
     44= Can I choose specific multiple post type for a single default image? =
    4545
    46 Yes, there is option from admin to set it for custom post types.
     46Yes, you can.
    4747
    48 = Can I choose custom image for default image? =
     48= Can I choose different images for different post-types/categories? =
    4949
    50 Yes, there is option from admin to set.
     50No, right now there is no such feature available but you can hire experts from our team or can request a completely custom plugin as per your need.
    5151
    5252== Changelog ==
     53= 1.5 =
     54* Compatible upto 4.9.5
     55* Minor bug fix
     56
    5357= 1.4 =
    5458* Compatible upto 4.5.1
  • wp-auto-featured-image/trunk/wp-auto-featured-image.php

    r1410827 r1878326  
    88 * License: GPLv2 or later
    99 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
    10  * Version: 1.4
     10 * Version: 1.5
    1111 
    1212    Copyright (c) 2014 by Sanny Srivastava (sannysrivastava@gmail.com)
     
    247247    if('settings_page_wp_auto_featured_image' == get_current_screen()->id) {
    248248        wp_enqueue_script('jquery');       
    249         wp_enqueue_script('thickbox');
    250         wp_enqueue_style('thickbox');       
    251         wp_enqueue_script('media-upload');
     249        // wp_enqueue_script('thickbox'); Removed 21 May 2018
     250        // wp_enqueue_style('thickbox');     Removed 21 May 2018   
     251        wp_enqueue_script( 'media-upload' );
     252        wp_enqueue_media(); // Added 21 May 2018
    252253        wp_enqueue_script('wafi-script');
    253254    }
     
    270271    # Check if this suppose to be set thumbnail.
    271272    if((!empty($options['wpafi_post_type'])) && (is_array($options['wpafi_post_type'])) && (in_array($post_type, $options['wpafi_post_type']) != 0) && (has_post_thumbnail( $post_id ) == false)) {
    272    
     273        //die('============== S A N N Y ==================');
    273274        # If category filter is on.
    274275        if((is_array($options['wpafi_categories'])) && ($post_type != 'page')){
     
    293294}
    294295
     296/*
     297Removed 21 May 2018
    295298function wedevs_send_to_editor( $html, $id ) {
    296299    return str_replace( '<a href', '<a data-id="' . $id . '" href', $html );
    297300}
    298301
    299 add_filter( 'image_send_to_editor', 'wedevs_send_to_editor', 10, 2 );
     302add_filter( 'image_send_to_editor', 'wedevs_send_to_editor', 10, 2 );*/
    300303
    301304
    302305# Custom button text for INSERT MEDIA button
     306/*
     307Removed 21 May 2018
    303308add_action( 'admin_init', 'wpfi_custom_button_text' );
    304309function wpfi_custom_button_text() {
     
    317322    }
    318323    return $translated_text;
    319 }
     324}*/
Note: See TracChangeset for help on using the changeset viewer.