I want to show the epaper of newspaper. Is there a way that i can embed a gallery of pdf in post just like the gallery of images

  • @cybmeta I tried creating the gallery of pdf but its not possible i think.. There were some solutions like upload a thumbnail and pdf. Then add that thumbnail to post and then change the custom url of that thumbnail so as to point to pdf.But it doesn't seem possible in case of gallery – aryan Jan 31 '15 at 10:41

You can use the Custom URL field, to modify the attachment link for each one of your gallery images:

Custom Attachment's URL

where this is supported by the following plugin:

 * Plugin Name:   Custom Attachments Links
 * Description:   Adds a new media field, to override the default attachment links.
 * Plugin URI:    http://wordpress.stackexchange.com/a/176668/26350
 * Plugin Author: Birgir Erlendsson (birgire)
 * Version:       0.0.1

add_filter( 'attachment_fields_to_edit', function( $fields, $post )
    $fields['wpse_custom_attachment_url'] = array(
        'label' => 'Custom URL',
        'input' => 'text',
        'value' => get_post_meta( $post->ID, 'wpse_custom_attachment_url', true ),
        'helps' => "Override the attachment's default",
    return $fields;
}, 10, 2 );

add_filter( 'attachment_fields_to_save', function( $post, $attachment )
    if( isset( $attachment['wpse_custom_attachment_url'] ) )
    return $post;
}, 10, 2 );

! is_admin() && add_filter( 'attachment_link', function( $link, $pid )
    if( $url = get_post_meta( $pid, 'wpse_custom_attachment_url', true ) )
        $link = esc_url( $url );   
    return $link;
}, 10, 2 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.