Original request was:
At the moment it says ‘Archive for june 2016’ but I want it to be just June 2016.
Two ways you can do this. I am showing both methods at below:
Method 1
‘Archive for ‘ is using by the internationalization function (__() ). By “gettext” filter we can remove this translated text. Open your functions.php file and just put this snippets at bottom of the file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<?php //* Don't include this line /** * How to change the date archive title * * @author Chinmoy Paul * @link https://www.paulchinmoy.com * @copyright Copyright (c) 2015 - 2016 Genesis Developer * @license GPL - 2.0+ */ add_filter( 'gettext', 'gd_remove_date_archive_title_text', 20, 3 ); function gd_remove_date_archive_title_text( $translated_text, $text, $domain ) { if ( is_date() ) { switch ( $translated_text ) { case 'Archives for ' : $translated_text = ''; break; } } return $translated_text; } |
Method 2
genesis/lib/structure/archive.php file have genesis_do_date_archive_title() function which is calling by genesis_before_loop hook. This function is printing the date archive title. At first we need to remove this default hook and create a new one. Again you will write the following scripts in your functions.php file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
remove_action( 'genesis_before_loop', 'genesis_do_date_archive_title' ); add_action( 'genesis_before_loop', 'themeprefix_do_date_archive_title' ); function themeprefix_do_date_archive_title() { if ( ! is_date() ) { return; } if ( is_day() ) { $headline = get_the_date(); } elseif ( is_month() ) { $headline = single_month_title( ' ', false ); } elseif ( is_year() ) { $headline = get_query_var( 'year' ); } if ( $headline ) { printf( '<div %s><h1 %s>%s</h1></div>', genesis_attr( 'date-archive-description' ), genesis_attr( 'archive-title' ), strip_tags( $headline ) ); } } |
Leave a Reply