How to Display Featured Image on Blog Posts (Genesis Theme)

If your featured image is not showing on single blog posts, you can add it manually using a hook.

Step 1 — Install Plugin

Install and activate the Genesis Simple Hooks plugin.

Step 2 — Add the Code

Go to Genesis → Simple Hooks, then choose a hook based on where you want the image to appear.

For example:

  • genesis_before_entry_content → image appears before post content
  • genesis_entry_content → image appears inside content (top)
  • genesis_after_entry_content → image appears below content

Paste the following code:

<?php 
if ( ! is_singular( 'post' ) )
    return;

$img = genesis_get_image( array(
    'format' => 'html',
    'size' => genesis_get_option( 'image_size' ),
    'attr' => array( 'class' => 'post-image' )
) );

printf(
    '<a href="%s" title="%s" style="display:block; margin-bottom:30px;">%s</a>',
    get_permalink(),
    the_title_attribute( 'echo=0' ),
    $img
);
?>

Step 3 — Enable PHP Execution

Make sure to check “Execute PHP on this hook?”

Step 4 — Save

Click save and refresh your site.

Important

Make sure you’ve set a featured image in your post editor, otherwise the image won’t appear.

Views: 3