Changeset 1631576
- Timestamp:
- 04/06/2017 11:18:31 PM (9 years ago)
- Location:
- rb-external-thumbnail/trunk
- Files:
-
- 2 edited
-
rb-external-thumbnail.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rb-external-thumbnail/trunk/rb-external-thumbnail.php
r1511791 r1631576 5 5 * Description: External images for post thumbnail. 6 6 * Author: Rodrigo Brito 7 * Version: 1. 27 * Version: 1.3 8 8 * Author URI: http://www.rodrigobrito.net/ 9 9 * Text Domain: rb-external-thumbnail … … 94 94 return $metadata; 95 95 } 96 97 98 add_filter( 'get_post_metadata', 'rb_external_inject_thumbnail_id', 10, 4 ); 99 100 function rb_external_inject_thumbnail_id ( $value, $post_id, $meta_key, $single ) { 101 if ( $meta_key === '_thumbnail_id' ) { 102 $url_thumbnail_external = get_post_meta( $post_id ,'thumbnail_external', true ); 103 if( !empty($url_thumbnail_external) ){ 104 return "ext-" . $post_id; 105 } 106 } 107 return $value; 108 } 109 110 add_filter( 'wp_get_attachment_image_src', 'rb_external_attachment_image_src', 10, 4 ); 111 112 function rb_external_attachment_image_src( $image, $attachment_id, $size, $icon ){ 113 if(isset($attachment_id) && !empty($attachment_id) && substr($attachment_id, 0, 3) === "ext"){ 114 $id = substr($attachment_id, 4); 115 $thumbnail = get_post_meta( $id ,'thumbnail_external', true ); 116 return Array ( $thumbnail, 0, 0, false ); 117 } 118 return $image; 119 } -
rb-external-thumbnail/trunk/readme.txt
r1511791 r1631576 3 3 Tags: thumbnail, custom, external 4 4 Requires at least: 3.0.1 5 Tested up to: 4. 6.16 Stable tag: 1. 25 Tested up to: 4.7.3 6 Stable tag: 1.3 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 33 33 = 1.2 = 34 34 * Translation for other languagess 35 36 = 1.3 = 37 * Support for external thumbnail called by wp_get_attachment_url
Note: See TracChangeset
for help on using the changeset viewer.