Skip to content

Instantly share code, notes, and snippets.

@bpmore
Forked from anonymous/functions.php
Last active August 29, 2015 14:12
Show Gist options
  • Save bpmore/d9943265fd68f4c8ab0d to your computer and use it in GitHub Desktop.
Save bpmore/d9943265fd68f4c8ab0d to your computer and use it in GitHub Desktop.
add_action( 'genesis_entry_content', 'os_show_featured_image_single_posts', 9 );
function os_show_featured_image_single_posts() {
global $post;
if ( ! is_singular( 'post' ) ) {
return;
}
// Get the featured image HTML
$image_html_args = array(
'size' => 'post-image',
'attr' => array(
'class' => 'aligncenter featured-image size-full wp-image-' . $post->ID .'',
),
);
$image_html = genesis_get_image( $image_html_args );
// Get the featured image URL for the lightbox a href only
$image_url_args = array(
'format' => 'url',
);
$image_url = genesis_get_image( $image_url_args );
// Display the Image using both calls above
echo '<a rel="lightbox" href="' . $image_url . '">'. $image_html .'</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment