Tag Info

Hot answers tagged


Second pass. Known issues: Needs caching (and the cache needs to be tidied up where possible) Post types are hard-coded Which post statuses are we interested in? Here's the function: /** * Given an attachment ID, searches for any post with that attachment used * as a featured image, or if it is present in the content of the post. * (Note above known ...


Just as an addition, as an improvement to account for different image sizes, I would do: $file_name = pathinfo( $file, PATHINFO_FILENAME ); $file_extension = '.' . pathinfo( $file, PATHINFO_EXTENSION ); Instead having a combined value for $file. And change the SQL preparation to: $prepared_sql = $wpdb->prepare( $sql, $id, ...


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'); });


Have you tried to use get_children() function? Edit: All media attached to any post is treated as children of it. The function wp_get_attachment_image() will only return images. With the function get_children() you'll be able to get all the media, images or anything else. In the above link, you can find some examples.

Only top voted, non community-wiki answers of a minimum length are eligible