Created
July 19, 2013 19:11
-
-
Save codearachnid/6041616 to your computer and use it in GitHub Desktop.
rewrite the tribe event featured image on single event view templates with a custom size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// rewrite the tribe event featured image on single event view templates with a custom size | |
function custom_tribe_event_featured_image( $featured_image ){ | |
if( is_single() ){ | |
$post_id = get_the_ID(); | |
$size = 'hbgm-news-full'; | |
$image_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), $size ); | |
$featured_image = ''; | |
if ( !empty( $image_src ) ) { | |
$featured_image = '<a href="'. tribe_get_event_link() .'" title="'. get_the_title( $post_id ) .'" rel="lightbox"><img src="'. $image_src[0] .'" title="'. get_the_title( $post_id ) .'" class="alignleft" /></a>'; | |
} | |
} | |
return $featured_image; | |
} | |
add_filter( 'tribe_event_featured_image', 'custom_tribe_event_featured_image'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment