Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.