WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Removing 'Archives' from category title (7 posts)

  1. seatpitch
    Member
    Posted 1 year ago #

    Hi,

    I've searched all I can but can't see a specific answer...

    Is there a way of removing ‘archives’ from the title on category pages?

    For example, it reads ‘NEWS Archives — Seat Pitch’ at the top of this page: http://seatpitch.co.uk/news/

    I’d like it just to say ‘NEWS — Seat Pitch’.

    I've changed the single_cat_title in the Twenty Eleven and Twenty Ten parent themes.

    Not quite sure what to do in my theme that won't affect the coding, I suspect it's the custom functions file — extracts here (I could be wrong though?)...

    #if the title is being displayed on index pages (categories/archives/search results)
    	if (is_category() || is_archive() || is_search()) {
    		if ($options['seo_index_type'] == 'index_type_1') echo get_bloginfo('name').$options['seo_index_separate'].wp_title('',false,'');
    		if ($options['seo_index_type'] == 'index_type_2') echo wp_title('',false,'').$options['seo_index_separate'].get_bloginfo('name');
    		if ($options['seo_index_type'] == 'index_type_3') echo wp_title('',false,'');
    		 }
    } 
    
    /*this function controls the meta description display*/
    function description() {
    	global $options;
    
    	#homepage descriptions
    	if (is_home() && $options['seo_home_description'] == 'On') echo '<meta name="description" content="'.$options['seo_home_descriptiontext'].'" />';
    
    	#single page descriptions
    	global $wp_query;
    	if (isset($wp_query->post->ID)) $postid = $wp_query->post->ID;
    	$key2 = 'izi_seo_single_field_description';
    	if (isset($postid)) $exists = get_post_meta($postid, $key2, true);
    	if ($options['seo_single_description'] == 'On' && $exists !== '') {
    		if (is_single() || is_page()) echo '<meta name="description" content="'.$exists.'" />';
    	}
    
    	#index descriptions
    	remove_filter('term_description','wpautop');
    	$cat = get_query_var('cat');
        $exists2 = category_description($cat);
    	if ($exists2 !== '' && $options['seo_index_description'] == 'On') {
    		if (is_category()) echo '<meta name="description" content="'. $exists2 .'" />';
    	}
    	if (is_archive() && $options['seo_index_description'] == 'On') echo '<meta name="description" content="Currently viewing archives from'. wp_title('',false,'') .'" />';
    	if (is_search() && $options['seo_index_description'] == 'On') echo '<meta name="description" content="'. wp_title('',false,'') .'" />';
    }
    
    /*this function controls canonical urls*/
    function canonical() {
    	global $options;
    
    	#homepage urls
    	if (is_home() && $options['seo_home_canonical'] == 'On') echo '<link rel="canonical" href="'.get_bloginfo('url').'" />';
    
    	#single page urls
    	global $wp_query;
    	if (isset($wp_query->post->ID)) $postid = $wp_query->post->ID;
    	if ($options['seo_single_canonical'] == 'On') {
    		if (is_single() || is_page()) echo '<link rel="canonical" href="'.get_permalink().'" />';
    	}
    
    	#index page urls
    	if ($options['seo_index_canonical'] == 'On') {
    		if (is_archive() || is_category() || is_search()) echo '<link rel="canonical" href="'.get_permalink().'" />';
    	}
    }

    Thanks in advance!

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    I've changed the single_cat_title in the Twenty Eleven and Twenty Ten parent themes.

    Do not edit the Twenty Eleven or Twenty Ten themes. The former is the default WordPress theme and having access to an unedited version of the theme is vital when dealing with a range of site issues. First create a child theme for your changes.

  3. seatpitch
    Member
    Posted 1 year ago #

    Thanks, I've changed the themes back...

    Spent weeks trying to figure this but just realised Yoast SEO seems to do the trick.

    Cheers

  4. Miz.Michele
    Member
    Posted 1 year ago #

    @seatpitch. Can you tell me exactly what you changed in Yoast? I'm trying to do the exact same thing

  5. seatpitch
    Member
    Posted 1 year ago #

    @Miz.Michele

    If you go to Taxonomies in Titles & Meta in Yoast, just delete 'Archives' from the Title Template...

  6. Miz.Michele
    Member
    Posted 1 year ago #

    Thanks. I must be very dense because I looked before even seeing your post and still can't figure it out.

    In Yoast, title and meta I have this for categories

    %%term_title%% | %%sitename%%

    and this for meta

    %%category_description%%

    I don't even see archives

    I am actually trying to remove the category heading all together because I am running a feed - - grrrr

    TX

  7. JohnMaskell
    Member
    Posted 1 year ago #

    Thanks guys, you just resolved my 'head scratcher' about that 'Archive' text appearing on page titles.

Topic Closed

This topic has been closed to new replies.

About this Topic