Skip to content

Instantly share code, notes, and snippets.

@fovoc
Created November 21, 2014 11:40
Show Gist options
  • Save fovoc/592f24592a40215b144d to your computer and use it in GitHub Desktop.
Save fovoc/592f24592a40215b144d to your computer and use it in GitHub Desktop.
Shoestrap 3 - display featured image of single posts into the extra header area
<?php
/*
* Display featured images in extra header area of individual posts
*/
function my_featured_image() {
global $ss_framework, $ss_settings;
$data = array();
if ( ! has_post_thumbnail() || '' == get_the_post_thumbnail() ) {
return;
}
// only in single posts
if ( is_single() ) {
$data['url'] = wp_get_attachment_url( get_post_thumbnail_id() );
// $data['width'] = Shoestrap_Layout::content_width_px();
$data['width'] = '1920';
$data['height'] = '350';
}
$image = Shoestrap_Image::image_resize( $data );
echo $ss_framework->clearfix() . '<a href="' . get_permalink() . '"><img class="featured-image ' . $ss_framework->float_class('left') . '" src="' . $image['url'] . '" /></a>';
}
add_action( 'shoestrap_pre_wrap', 'my_featured_image' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment