Skip to content

Instantly share code, notes, and snippets.

@bavington
Created January 11, 2014 13:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bavington/8371007 to your computer and use it in GitHub Desktop.
Save bavington/8371007 to your computer and use it in GitHub Desktop.
Sample code for adding Schema.org markup to your website's company logo.
<div itemscope itemtype="http://schema.org/Organization">
<?php
$attachment_id = 2; // Upload your client's logo to the Media Library and add the attachment ID here (swap the 2)
$image_attributes = wp_get_attachment_image_src( $attachment_id );
?>
<a itemprop="url" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home" id="logolink">
<img itemprop="logo" src="<?php echo $image_attributes[0]; ?>" id="mainlogo" alt="<?php echo get_bloginfo ( 'description' ); ?>" />
</a>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment