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
1 Answer
You can use the Custom URL field, to modify the attachment link for each one of your gallery images:
where this is supported by the following plugin:
<?php
/**
* 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'] ) )
update_post_meta(
$post['ID'],
'wpse_custom_attachment_url',
$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 );