Tag Info

Hot answers tagged

3

I wonder if you want to modify the HTML of the inserted image, with the image_send_to_editor or get_image_tag filters? If that's the case, then here's one example: /** * Add the data-ext-link-title and data-ext-link-url attributes to inserted images. */ add_filter( 'image_send_to_editor', function( $html, $id, $caption, $title, $align, $url, ...


2

You're on the right path with a rewrite rule. If you're just delivering a file, you can hook an early action, check if a download was requested, then output the file and exit before WordPress ever gets to the stage of querying the database and deciding the request is a 404. // add the download ID query var which we'll set in the rewrite rule function ...


2

You can try the following example, for image attachments: add_action( 'init', function() { add_rewrite_endpoint( 'download', EP_ROOT ); add_action( 'template_redirect', function() { if ( $pid = get_query_var( 'download' ) ) { $found = false; ...


2

Some ideas for your attachments file: A simplification: $tmp = $post; // Store the current global post object $post = get_post( $post->post_parent ); // Use the post parent post object $media = get_attached_media( 'audio' ); if( $media ) { $sc = "[audio]"; if( count( $media ) > 1 ) { $ids = join( ',', ...


1

The Image added by Add Media is included in the Content.So I have splitted the image from the content.Below is the working code for my Question. <?php $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); ?> <div class ="single-post-flex-slider"> <ul class="slides"> <?php ...


1

Maybe you have an image that was smaller or equal to the thumbnail size, if so, then no thumbnail will be created, and this.data[i].sizes.thumbnail will be undefined.



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