• Hi there,
    I looked all in the theme core files and I couldn’t find just the word “Archives:” to remove it. Where to do so?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Check your widgets to see if you have the Archives widget added. If so you can either remove it or fill in the title field to a desirable name.

    Thread Starter Cashlin

    (@cashlin)

    I don’t have that Widget in place.

    Here’s the page in Q: https://www.tradestraining.online/courses/
    The big orange bar Archives: I need the bar and ‘Courses’ to remain. But ‘Archives:’ to go away.

    Hello @cashlin

    To solve the following issue yo need to create and activate child theme.

    Child theme reference:
    Child Theme
    Child Theme

    Or you can simply create the child theme using Plugin

    Child Theme generator

    After successfully creating and activating child theme, in your child theme’s functions.php file please add the below code.

    add_filter( 'get_the_archive_title', function ($title) {
    
        if ( is_category() ) {
    
                $title = single_cat_title( '', false );
    
            } elseif ( is_tag() ) {
    
                $title = single_tag_title( '', false );
    
            } elseif ( is_author() ) {
    
                $title = '<span class="vcard">' . get_the_author() . '</span>' ;
    
            }
    
        return $title;
    
    });

    I hope this will resolve your issue.

    If you any confusion while achieving this result please let us know.

    Best Regards!!

    Thread Starter Cashlin

    (@cashlin)

    Thanks for responding. I appreciate it.

    I am using a child theme and put your code in, but ‘Archives’ is still persisting.

    Here’s my child theme functions file code:

    <?php
    function my_theme_enqueue_styles() {
        $parent_style = 'parent-style'; 
        wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
        wp_enqueue_style( 'child-style',
            get_stylesheet_directory_uri() . '/style.css',
            array( $parent_style ),
            wp_get_theme()->get('Version')
        );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    
    add_filter( 'get_the_archive_title', function ($title) {
        if ( is_category() ) {
                $title = single_cat_title( '', false );
            } elseif ( is_tag() ) {
                $title = single_tag_title( '', false );
            } elseif ( is_author() ) {
                $title = '<span class="vcard">' . get_the_author() . '</span>' ;
            }
        return $title;
    });
    
    ?>

    I am using LearnPress. Would that require a different code for the functions logic?

    Hello,

    You can try replacing the specific words from the title via the function below to see if it works for the LearnPress Archive title :

    add_filter('get_the_archive_title', function ($title) {
        return preg_replace('Archives: ', '', $title);
    });

    Hope this Helps,

    Best Regards !!

    Thread Starter Cashlin

    (@cashlin)

    Thanks again! I tried the filter you listed and it didn’t do anything… so I modified it and it worked:

    add_filter( 'get_the_archive_title', function( $title ) { 
      return 'Courses'; 
    });

    I appreciate your responses. This thread’s good to go.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Where to remove “Archive:” text from archives page’ is closed to new replies.