Skip to content

Instantly share code, notes, and snippets.

@gcman105
Created October 19, 2016 09:17
Show Gist options
  • Save gcman105/9da8bdcf055c30b6d67524f02492ae13 to your computer and use it in GitHub Desktop.
Save gcman105/9da8bdcf055c30b6d67524f02492ae13 to your computer and use it in GitHub Desktop.
Warp a DIV around img tags for styling
<?php
//do not copy above opening php tag when pasting into a functions.php file
//* Remove default post image
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
//* Add wrapped post image
add_action( 'genesis_entry_content', 'dynamik_wrapped_featured_image', 8 );
function dynamik_wrapped_featured_image() {
if ( is_singular() || ! genesis_get_option( 'content_archive_thumbnail' ) )
return;
if ( $image = genesis_get_image( array( 'format' => 'url', 'size' => genesis_get_option( 'image_size' ) ) ) ) {
printf( '<div class="featured-image-wrap"><img src="%s" alt="%s" /></div>', $image, the_title_attribute( 'echo=0' ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment