skip to Main Content

I am trying to remove the words “Category Archives:” on the posts category page or The7 WordPress Theme.

This one really has me stumped. I have gone through every file in the theme that I can think of and even tried to change this via the SEO plugin but am having no luck.

I was wondering if anyone had any ideas?

Here is the development site address: http://bellparktest.com/category/research-center/

Thank you,

Derek

4

Answers


  1. I’m not sure about ‘Category Archives:’, I only see ‘Category:’—that can be removed e.g. with the plugin ‘Slash Admin’ (‘Frontend > Miscellaneous > Remove “Category:” from archives’). That seems to accomplish the task as follows (remove the ‘if’ around the ‘add_filter’ if you implement this yourself):

    /*
     * Remove "Category:" from archives
     */
    function slashadmin_remove_category( $title ) {
        if ( is_category() ) {
            $title = single_cat_title( '', false );
        }
        if ( is_post_type_archive() ) {
            $title = post_type_archive_title( '', false );
        }
        if ( is_tax() ) {
            $title = single_term_title( '', false );
        }
    
        return $title;
    }
    
    if ( slash_admin( 'remove_category' ) ) {
        add_filter( 'get_the_archive_title', 'slashadmin_remove_category', 10, 2 );
    }
    
    Login or Signup to reply.
  2. Disable the page title via Custom CSS located in Advanced CSS in Theme Options.

     .category-research-center .page-title { 
     display: none !important;
     }
    
    Login or Signup to reply.
  3. OK- First of all – You should use the theme’s child theme to make this kind of modification because when you make an update in the future it will wipe out all your changes.

    You should look for the function “function presscore_get_page_title()” inside > wp-content > themes > dt-the7 > inc > helpers> .

    copy it from line 12: “if ( ! function_exists( ‘presscore_get_page_title’ ) ) :”
    to line 97 “endif;”

    paste it inside your child theme “function.php” > wp-content > themes > dt-the7-child .

    then change ‘category’ => __( ‘Category Archives: %s’, ‘the7mk2’ ), to ‘category’ => __( ‘ %s’, ‘the7mk2’ ),

    You should get something like this:

    // THIS FUNCTION REMOVES "Category Archives:" FROM BLOG POSTS
    
     if ( ! function_exists( 'presscore_get_page_title' ) ) :
    
        /**
         * Function return current page title.
         *
         * @return string
         */
        function presscore_get_page_title() {
            $default_page_title_strings = array(
                'search' => __( 'Search Results for: %s', 'the7mk2' ),
                'category' => __( '%s', 'the7mk2' ),
                'tag' => __( 'Tag Archives: %s', 'the7mk2' ),
                'author' => __( 'Author Archives: %s', 'the7mk2' ),
                'day' => __( 'Daily Archives: %s', 'the7mk2' ),
                'month' => __( 'Monthly Archives: %s', 'the7mk2' ),
                'year' => __( 'Yearly Archives: %s', 'the7mk2' ),
                'archives' => __( 'Archives: ', 'the7mk2' ),
                'page_404' => __( 'Page not found', 'the7mk2' ),
                'blog' => __( 'Blog', 'the7mk2' ),
            );
    
            /**
             * Filter all default titles at once.
             *
             * @since 4.2.1
             */
            $page_title_strings = apply_filters( 'presscore_page_title_strings', $default_page_title_strings );
            $page_title_strings = wp_parse_args( $page_title_strings, $default_page_title_strings );
    
            $title = '';
    
            if ( is_home() && ! is_front_page() ) {
                $title = single_post_title( '', false );
    
            } elseif ( is_page() || is_single() ) {
                $title = get_the_title();
    
            } elseif ( is_search() ) {
                $title = sprintf( $page_title_strings['search'], '<span>' . get_search_query() . '</span>' );
    
            } elseif ( is_archive() ) {
    
                if ( is_category() ) {
                    $title = sprintf(
                        $page_title_strings['category'],
                        '<span>' . single_cat_title( '', false ) . '</span>'
                    );
    
                } elseif ( is_tag() ) {
                    $title = sprintf( $page_title_strings['tag'], '<span>' . single_tag_title( '', false ) . '</span>' );
    
                } elseif ( is_author() ) {
                    the_post();
                    $title = sprintf(
                        $page_title_strings['author'],
                        '<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">' . get_the_author() . '</a></span>'
                    );
                    rewind_posts();
    
                } elseif ( is_day() ) {
                    $title = sprintf( $page_title_strings['day'], '<span>' . get_the_date() . '</span>' );
    
                } elseif ( is_month() ) {
                    $title = sprintf( $page_title_strings['month'], '<span>' . get_the_date( 'F Y' ) . '</span>' );
    
                } elseif ( is_year() ) {
                    $title = sprintf( $page_title_strings['year'], '<span>' . get_the_date( 'Y' ) . '</span>' );
    
                } else {
                    $title = $page_title_strings['archives'];
    
                }
            } elseif ( is_404() ) {
                $title = $page_title_strings['page_404'];
    
            } else {
                $title = $page_title_strings['blog'];
    
            }
    
            return apply_filters( 'presscore_get_page_title', $title );
        }
    
    endif;
    
    Login or Signup to reply.
  4. You have this filter for all cases: “get_the_archive_title”. But then there are different cases.

    For exemple for simple category you can do :

    function prefix_category_title( $title ) {
      if(is_category()){
        $title = single_cat_title( '', false );
      }
      return $title;
    }
    add_filter( 'get_the_archive_title', 'prefix_category_title' );
    

    For custom post type you should do :

    function prefix_category_title( $title ) {
      if(is_archive('slug-of-your-custom-post-type')){
        $title = single_cat_title( '', false );
      }
      return $title;
    }
    add_filter( 'get_the_archive_title', 'prefix_category_title' );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search