Images are registered in media library but still won’t show up
Images are registered in media library but still won’t show up
Images are registered in media library but still won’t show up
You need to en-queue your styles and scripts in your media upload hook and then clal wp_iframe function. Just do it like this and it will work: <?php add_filter( ‘media_upload_tabs’, ‘olab_add_media_tab’ ); function olab_add_media_tab( $tabs ) { $tabs[‘bildarkiv’] = __( ‘Bildarkiv’, ‘bildarkiv’ ); return $tabs; } add_action( ‘media_upload_bildarkiv’, ‘olab_tab_iframe’ ); function olab_tab_iframe() { wp_register_style( ‘bak-css’, … Read more
I found the solution. You have to de-regsiter and add the wp-mediaelement script to add the features.
You can bind to the ‘ended’ event by targeting the audio element in the playlist: $(‘.wp-playlist .mejs-mediaelement audio’).on(‘ended’, function (event) { console.log(‘ended’); }); The ‘click’ events are just standard, eg: $(‘.wp-playlist-item’).on(‘click’, function (event) { console.log(‘clicked’); });
EDIT: With some help of a friend I came up with a solution. For everyone interested: Use a custom post-type, in my case comment_post. Then upload the images like this: $new_post = array( ‘post_title’ => $title, ‘post_content’ => $comment, ‘post_status’ => ‘pending’,// Choose: publish, preview, future, draft, etc. ‘post_type’ => ‘comments_post’ // Use a custom … Read more
VERSION 1 will query all the images and give you a count by checking the size of the returned array. VERSION 2 is a much faster method introduced by birgire. // VERSION 1 $images = get_posts(array( ‘post_type’ => ‘attachment’, ‘post_status’ => ‘any’, ‘numberposts’ => -1, ‘fields’ => ‘ids’, ‘post_mime_type’ => ‘image/jpeg,image/gif,image/jpg,image/png’, )); echo count($images) . … Read more
add below code after echo $attach_id…. set_post_thumbnail( $post_id , $attach_id);
You are almost certainly going to need to write a set of scripts to accomplish what you are looking to do. The first step would be get all of them imported as attachments. You’ve got a great set of specs for those scripts so the next step is to write each of them (actually, each … Read more
Invalid argument supplied for foreach means that the X in foreach X as … is not an array. You can prevent this error by type casting; add (array) before the argument in the foreach statement. This will turn your variable into an array, essentially. In your code, the change would be… foreach ( (array) $attach_meta[‘sizes’] … Read more
I know it’s one year old but just in case someone else is also searching: You could upload the main files (not all 3 sizes, just the original images) via FTP to another directory on your server and then use the Add-From-Server Plugin.