Last active
October 2, 2019 05:21
-
-
Save davidraedev/aeffd1a90c9a8f8a2fb661e75880081d to your computer and use it in GitHub Desktop.
powerpress add upload to metabox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- custom upload button --> | |
<button id="custom_uploader">upload mp3</button> | |
<script> | |
$( "#custom_uploader" ).click( function() { | |
const send_attachment_bkp = wp.media.editor.send.attachment; | |
const button = $(this); | |
wp.media.editor.send.attachment = function( props, attachment ) { | |
$( button ).parent().prev().attr( "src", attachment.url ); | |
$( button ).prev().val( attachment.id ); | |
wp.media.editor.send.attachment = send_attachment_bkp; | |
$( "#powerpress_url_podcast" ).val( attachment.url ); | |
setTimeout( function(){ | |
$( "#powerpress_check_podcast_button" ).trigger( "click" ); | |
}, 1 ); | |
} | |
wp.media.editor.open( button ); | |
return false; | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add around line 206 on powerpressadmin-metabox.php
Auto fills in the url and submits the verify url for you.