Skip to content

Instantly share code, notes, and snippets.

@nobuhiko
Created April 29, 2012 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nobuhiko/2523197 to your computer and use it in GitHub Desktop.
Save nobuhiko/2523197 to your computer and use it in GitHub Desktop.
WP Account Auto-Discovery
function add_text_before_head_close_tag() {
if (is_single() || is_page()) {
$url = get_permalink();
} else {
$url = get_bloginfo('url');
}
echo '
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:foaf="http://xmlns.com/foaf/0.1/">
<rdf:Description rdf:about="'.$url.'">
<foaf:maker rdf:parseType="Resource">
<foaf:holdsAccount>
<foaf:OnlineAccount foaf:accountName="[hatena acount]">
<foaf:accountServiceHomepage rdf:resource="http://www.hatena.ne.jp/" />
</foaf:OnlineAccount>
</foaf:holdsAccount>
</foaf:maker>
</rdf:Description>
</rdf:RDF>
';
}
add_action('wp_head', 'add_text_before_head_close_tag', 100);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment