The look and feel of my website is coming on great thanks to all your help. But I just got another problem. I am trying to change the “Author Archives:” headline text to something else, without changing the template-tags.php file in the original theme. Copying it over to the root of the child-theme or indeed in an “inc” folder in the child does not work. Neither does including it in the functions.php or adding this line
require_once( get_stylesheet_directory() . '/inc/template-tags.php' );
I am at a loss here, and have searched and searched without finding a solution to the problem.
Hi Tor
You’ll need to use a child theme to do this. Create a functions.php in your child theme and add the following:
<?php if( !function_exists( 'vantage_get_archive_title' ) ) : /** * Return the archive title depending on which page is being displayed. * * @since vantage 1.0 */ function vantage_get_archive_title(){ $title = ''; if ( is_category() ) { $title = sprintf( __( 'My Category Archives: %s', 'vantage' ), '<span>‘ . single_cat_title( ”, false ) . ‘</span>‘ ); } elseif ( is_tag() ) { $title = sprintf( __( ‘Tag Archives: %s’, ‘vantage’ ), ‘<span>‘ . single_tag_title( ”, false ) . ‘</span>‘ ); } elseif ( is_author() ) { the_post(); $title = sprintf( __( ‘Author Archives: %s’, ‘vantage’ ), ‘<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me" rel="nofollow">‘ . get_the_author() . ‘</a></span>‘ ); rewind_posts(); } elseif ( is_day() ) { $title = sprintf( __( ‘Daily Archives: %s’, ‘vantage’ ), ‘<span>‘ . get_the_date() . ‘</span>‘ ); } elseif ( is_month() ) { $title = sprintf( __( ‘Monthly Archives: %s’, ‘vantage’ ), ‘<span>‘ . get_the_date( ‘F Y’ ) . ‘</span>‘ ); } elseif ( is_year() ) { $title = sprintf( __( ‘Yearly Archives: %s’, ‘vantage’ ), ‘<span>‘ . get_the_date( ‘Y’ ) . ‘</span>‘ ); } else { $title = __( ‘Archives’, ‘vantage’ ); } return apply_filters(‘vantage_archive_title’, $title); } endif;And edit as required. If you already have a functions.php file with contents in it then you don’t need the opening
Thank you so much, that worked like a charm!
Should probably be simple, but I could not find the answer anywhere! Well, now everything is good again!
Awesome; glad to hear you were able to resolve.