I have enabled a function when I uploaded an image, it auto create a post with that image as the featured image.
Now I wish to link to that featured image to that of the image file/media file URL so that lightbox effects can work on it. But not sure how to implement this? Any help will be highly appreciative. The function that I have used is -
add_action('add_attachment', 'create_post');
function create_post( $attach_ID ) {
$attachment = get_post( $attach_ID );
$my_post_data = array(
'post_title' => $attachment->post_title,
'post_type' => 'post',
'post_category' => array('0'),
'post_status' => 'publish'
);
$post_id = wp_insert_post( $my_post_data );
// attach media to post
wp_update_post( array(
'ID' => $attach_ID,
'post_parent' => $post_id,
) );
set_post_thumbnail( $post_id, $attach_ID );
return $attach_ID;
}
{}
symbol just above it. Add your code to the post, highlight it and click that{}
symbol. This will place your code in a code block as in my edit. :) – Pieter Goosen May 25 '14 at 12:15