Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: [Resolved] Change ’wrote a new blog post’ text.

I adapted it a little, to display a link to the category the post is in (assuming one category, and category slug of ‘category’) :

`class PJW_Translation_Mangler {

function filter_gettext($translation, $text, $domain) {
global $post;
$category = get_the_category($post->ID);
$cat_slug = $category[0]->slug;
$category = $category[0]->cat_name;
$translations = &get_translations_for_domain( $domain );
if ( $text == ‘%s wrote a new blog post: %s’ ) {
return $translations->translate( ‘%s wrote a new post: %s, in ‘.$category.’‘);
}
return $translation;
}
}
add_filter(‘gettext’, array(‘PJW_Translation_Mangler’, ‘filter_gettext’), 10, 4);`

Skip to toolbar