I know it’s an archive, there are lots of posts below. I don’t always want that text there in the title. It’d be nice if there were a checkbox to show it or not. There isn’t. Yet. So here goes. You’re going to need to put this monster code in your functions.php file of your child theme. Did you get all that? If that scares you, don’t do this and let me know if I can help. If you know where your functions.php file is and a bit how it works, here’s what you need to get rid of that word Archive.
function woo_archive_title ( $before = '', $after = '', $echo = true ) { global $wp_query; if ( is_category() || is_tag() || is_tax() ) { $taxonomy_obj = $wp_query->get_queried_object(); $term_id = $taxonomy_obj->term_id; $taxonomy_short_name = $taxonomy_obj->taxonomy; $taxonomy_raw_obj = get_taxonomy( $taxonomy_short_name ); } // End IF Statement $title = ''; $delimiter = ' | '; $date_format = get_option( 'date_format' ); // Category Archive if ( is_category() ) { $title = '<span class="fl cat">' . single_cat_title( '', false ) . '</span> <span class="fr catrss">'; $cat_obj = $wp_query->get_queried_object(); $cat_id = $cat_obj->cat_ID; $title .= '<a href="' . get_term_feed_link( $term_id, $taxonomy_short_name, '' ) . '">' . __( 'RSS feed for this section','woothemes' ) . '</a></span>'; $has_title = true; } // Day Archive if ( is_day() ) { $title = __( 'Archive', 'woothemes' ) . $delimiter . get_the_time( $date_format ); } // Month Archive if ( is_month() ) { $date_format = apply_filters( 'woo_archive_title_date_format', 'F, Y' ); $title = __( 'Archive', 'woothemes' ) . $delimiter . get_the_time( $date_format ); } // Year Archive if ( is_year() ) { $date_format = apply_filters( 'woo_archive_title_date_format', 'Y' ); $title = __( 'Archive', 'woothemes' ) . $delimiter . get_the_time( $date_format ); } // Author Archive if ( is_author() ) { $title = __( 'Author Archive', 'woothemes' ) . $delimiter . get_the_author_meta( 'display_name', get_query_var( 'author' ) ); } // Tag Archive if ( is_tag() ) { $title = __( 'Tag Archives', 'woothemes' ) . $delimiter . single_tag_title( '', false ); } // Post Type Archive if ( function_exists( 'is_post_type_archive' ) && is_post_type_archive() ) { /* Get the post type object. */ $post_type_object = get_post_type_object( get_query_var( 'post_type' ) ); $title = $post_type_object->labels->name . ' ' . __( 'Archive', 'woothemes' ); } // Post Format Archive if ( get_query_var( 'taxonomy' ) == 'post_format' ) { $post_format = str_replace( 'post-format-', '', get_query_var( 'post_format' ) ); $title = get_post_format_string( $post_format ) . ' ' . __( ' Archives', 'woothemes' ); } // General Taxonomy Archive if ( is_tax() ) { $title = sprintf( __( '%1$s Archives: %2$s', 'woothemes' ), $taxonomy_raw_obj->labels->name, $taxonomy_obj->name ); } if ( strlen($title) == 0 ) return; $title = $before . $title . $after; // Allow for external filters to manipulate the title value. $title = apply_filters( 'woo_archive_title', $title, $before, $after ); if ( $echo ) echo $title; else return $title; } // End woo_archive_title()
Nice work. Thanks for sharing. Works a treat.
Hi Paul,
Glad I could help!
Worked perfectly – I can’t believe I couldn’t find this simple solution in the WooThemes community forums!
I often have a hard time finding anything in ANY forums. I’m trying to make many posts here with tiny little solutions so they’re easier to find. Thanks for the note!
Works as promised, thanks!
Glad we could help, Kathleen!
Where do you have to place the code in functions.php? Thanks for the work btw!
It goes in the same place as your style.css file, in other words, in the child theme’s folder.
I already pasted the code on the functions.php file right under where it says “/* You can add custom functions below */” , what’s next? where will the checkbox appear?
By pasting that code, that should just remove the word Archive. Did it not work?
Hi, thanks for the code, but I have the same like Juan: I copied the code to funktions.php, but it does not work! I cleaned cache and I have the latest version of Canvas.
Thanks,
Ole
hi there,
I am running a new WP woo canvas site and am not a developer. I therefore need little bits of help from time to time, for example removing the word Archive (as above). Can you provide some paid time for support of my site from time to time when I get stuck? It’s a non-profit so wouldn’t be able to pay much.
Thanks.
Luke
Thanks, Bradley.
If anyone uses this and wants to maintain the RSS icon instead of having text, line 85 should look more like this:
$title .= ‘‘;
Ooops..
$title .= '';
I’m running canvas plus custom content types plugin and I’ve created a custom post called ‘talk’. I’d like to change the archive header text to just about anything! At the moment it says ‘Talk Archive’. I tried your code above and it did work for the standard woo archives but did nothing for this custom archive.
I tried this code:
/* Change Archive Template H1 */
add_filter( ‘woo_archive_title’, ‘new_woo_archive_title’ );
function new_woo_archive_title () {
$category = single_cat_title(“”, false);
$new_title = ”. $category .” . ” . strip_tags(category_description($category_id)) . ”;
return $new_title;
} // End filter
That worked for woo archives again, but this time it made the talk archive header text disappear. Any ideas?
Ooh, getting into filters and code … sounds like a question for the WOO team!
Any way to remove “Protected” from password protected page titles? Thanks!
Awesome! I was spending a lot of time looking through all the theme files, had no idea it was a functions fix! Thanks!
Hi,
I know this might seem weird, but I need to display the archive slug on my archive.php
If my Archive title is Cape Town
I want to display cape-town
hope you can help.
thank you,