Skip to content

Instantly share code, notes, and snippets.

@ThierryA
Created November 15, 2015 15:42
Show Gist options
  • Save ThierryA/53bffb0f01372985d36e to your computer and use it in GitHub Desktop.
Save ThierryA/53bffb0f01372985d36e to your computer and use it in GitHub Desktop.
Beans: set post default image.
<?php
// Do not include the opening php tag if it is already included in your file.
add_action( 'beans_post_body', 'beans_child_default_post_image', 5 );
function beans_child_default_post_image() {
// Stop here if the post has an image set.
if ( has_post_thumbnail() )
return;
// You may use beans_edit_image() if you need to create multiple size on the fly.
echo '<img src="' . get_stylesheet_directory_uri() . '/images/your-default-image.jpg" alt="">';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment