Skip to content

Instantly share code, notes, and snippets.

@seraphyn
Created July 26, 2014 09:01
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 seraphyn/32e71ed17ad3d40b5a19 to your computer and use it in GitHub Desktop.
Save seraphyn/32e71ed17ad3d40b5a19 to your computer and use it in GitHub Desktop.
Lösung für RichSnippets in dem Theme Twenty Thirteen von Wordpress. Gehört zu dem Kommentar von Janet ( http://got-tty.org/archives/rich-snippets-in-wordpress-und-google.html#comment-6102) des Beitrages http://got-tty.org/archives/rich-snippets-in-wordpress-und-google.html
<?php
//mod content
function hatom_mod_post_content ($content) {
if ( in_the_loop() && !is_page() ) {
$content = '’.$content.”;
}
return $content;
}
add_filter( ‘the_content’, ‘hatom_mod_post_content’);
//add hatom data
function add_mod_hatom_data($content) {
$t = get_the_modified_time(‘F jS, Y’);
$author = get_the_author();
$title = get_the_title();
if ( is_single() || is_page()) {
$content .= ”.$title.’ was last modified: ‘.$t.’ by ‘.$author.”;
}
return $content;
}
add_filter(‘the_content’, ‘add_mod_hatom_data’);
?>
Da ich nicht möchte, dass auf jeder Seite der Autor und das Aktualisierungsdatum steht, habe ich in die style.css des Child-Theme’s eingefügt:
/* Google rich snippets: alternative style to hide sentence from view */
.hatom-extra {display: none;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment