Embedded Post Customisation

Have you ever wanted to remove that unsightly site title?

Ever wanted to show who worked on the post?

Well I have and after quite a bit of searching and fiddling I figured it out.

/**
 * Removes the title.
 */
add_filter('embed_site_title_html','__return_false');
/**
 * Adds the author's name.
 */
add_action( 'embed_content', 'embed_author' );
/**
 * Add the author div to the embed iframe.
 */
function embed_author() {
    $output = '<div class="wp-embed-author">';
    $output .= '&mdash; ';
    $output .= get_the_author();
	$output .= " ";
    $output .= get_avatar( get_the_author_meta( 'ID' ), 20 );
    $output .= '</div>';
    echo $output;
}

Just slap this into your theme somewhere (in Beans they have a file called “Embed” that i slipped it into) and voilà! Your site title will disappear and be replaced with the author of the post!

Leave a Reply

%d bloggers like this: