- This topic has 2 replies, 2 voices, and was last updated 5 years, 4 months ago by
bicho44.
-
AuthorPosts
-
-
September 20, 2016 at 9:31 am #7354
bicho44MemberHi:
Maybe is a little over kill, but i need to use a URL to upload a video preview url (right know, a Youtube Preview image)
Im already can obtain the URL, but i need to insert as a Thumbnail image, so i can use it as preview image in the archive.
But, i can found how to do that.
I think maybe i can use that url as a base to the upload function, but im stuck.
Any help could be appreciate.
The Code i have.piklist ( 'field', array( 'type' => 'text', 'scope' => 'post_meta', 'field' => 'imgd_programa_video', 'label' => __('Link Youtube', 'imgd'), 'value' => '', 'attributes' => array( 'class' => 'text' ), 'position' => 'wrap' ) ); ?> <script> jQuery(document).ready(function( $ ) { $("#_post_meta_imgd_programa_video_0").on('change',function () { var ytl = $( "#_post_meta_imgd_programa_video_0" ).val(); var yti = ytl.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); //This is the post thumbnail, but... $('_post_meta__thumbnail_id_0').value("http://i3.ytimg.com/vi/"+ yti[1] + "/hqdefault.jpg"); }); }); </script> <?php piklist('field', array( 'type' => 'file' ,'field' => '_thumbnail_id' // Use these field to match WordPress featured images. ,'scope' => 'post_meta' ,'options' => array( 'title' => __('Imagenes del Show', 'imgd') ,'button' => __('Inserte las imagenes', 'imgd') ) )); -
September 22, 2016 at 12:31 pm #7376
SteveKeymasterYou want to add a YouTube url to imgd_programa_video, and then use the YouTube thumbnail as the preview in admin?
-
September 22, 2016 at 2:44 pm #7379
bicho44MemberHi @steve:
Yes, the idea is add the Youtube link in a text field, and capture the Image youtube serve as a thumbnail, and then download that image into the media library, and assign it as feature image for the CPT. LOL 😀
I know, i know, is a lot, but i think i can use the functions who use the upload field as a helper to download and then set the feature image.
As I said any pointer…
Best regards
-
-
AuthorPosts
- You must be logged in to reply to this topic.