Home › Forums › Support › Caption for post thumbnails › Reply To: Caption for post thumbnails
April 17, 2015 at 12:37 pm
#99615
Emily Condit
Hi, Tom.
Not sure what happened but I got a parse error on line 9 when I replaced the old remove function with the new one. This is what my functions.php looks like. Maybe you can tell me what the problem is?
<?php
/**
* Generate child theme functions and definitions
*
* @package Generate
*/
add_action('after_setup_theme','generate_remove_blog_post_image');
function generate_remove_blog_post_image()
{
remove_action( 'generate_after_entry_header', 'generate_blog_post_image' );
}
add_action( 'generate_after_entry_header', 'generate_post_image_caption' );
function generate_post_image_caption()
{
// If there's no featured image, return
if ( ! has_post_thumbnail() )
return;
// If we're not on any single post/page or the 404 template, we must be showing excerpts
if ( ! is_singular() && ! is_404() ) {
?>
<div class="post-image">
<a href="<?php the_permalink();?>" title="<?php the_title(); ?>"><?php the_post_thumbnail( 'full', array('itemprop' => 'image') ); ?><?php if ( function_exists( 'cc_featured_image_caption' ) ) : cc_featured_image_caption(); endif; ?></a>
</div>
<?php
}
}
Thanks!
🙂 Emily