Custom Taxonomy change text "Category Archive" on Category pages to be the Category Title
-
I have used the following function provided by Syahir in a previous post:
function graphene_filter_gettext( $translated, $original, $domain ) {
$strings = array(
'Category Archive: <span>%s</span>' => '<span>%s</span>',
);
if ( ! empty( $strings[$original] ) ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );How can I get this to work for custom taxonomies as well?
What is the url where your custom taxonomy is displayed?
Admin
function graphene_filter_gettext( $translated, $original, $domain ) {
$strings = array(
'Category Archive: <span>%s</span>' => '<span>%s</span>',
'%1$s Archive: %2$s' => '%2$s',
);
if ( ! empty( $strings[$original] ) ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );I have tried pasting this code into my child theme but it came up with this error:
Parse error: syntax error, unexpected ‘%’ in C:wampwwwwp-contentthemesgraphene-childfunctions.php on line 14
How can I get back into my site to try again? My site is on localhost.
Admin
I’ve corrected the code above. It was missing the single quotes.
Viewing 7 posts - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.
