• Resolved kupili

    (@kupili)


    Hi,
    I want to change time archives title: Daily Archives, Monthly Archives,…

    I found it in class-content-headings.php file. This function is taking a lot of code so I don’t know if it is a smart thing to change it in child theme. Is it possible if you add that in live customizer under other archive titiles?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi,

    Have you tried these options?

    Appearance -> Customize -> Content -> Post lists
    scroll of the end of the settings.
    https://i.imgur.com/WsvNXc1.jpg

    Hope this helps.

    Thanks!

    Thread Starter kupili

    (@kupili)

    Yes. I tried all of those. In fact, this is exact location of where it should be. None of those works for time based archives because it is hardcoded in class-content-headings.php.

    Good day to you!

    Hi Kupili,
    It is indeed hardcoded, but with a filter.
    So, add a filter and hook into tc_time_archive_header_content to achieve your purpose.

    Something like this bit of code can be added to your child theme’s functions.php to overwrite the existing header.

    add_filter('tc_time_archive_header_content','my_time_archive_header_content');
    function my_time_archive_header_content($content) {
    
       if ( is_day() || is_month() || is_year() ) {
                $archive_type   = is_day() ? sprintf( __( 'My Daily Archives: %s' , 'customizr' ), '<span>' . get_the_date() . '</span>' ) : __( 'Archives' , 'customizr' );
                $archive_type   = is_month() ? sprintf( __( 'My Monthly Archives: %s' , 'customizr' ), '<span>' . get_the_date( _x( 'F Y' , 'monthly archives date format' , 'customizr' ) ) . '</span>' ) : $archive_type;
                $archive_type   = is_year() ? sprintf( __( 'My Yearly Archives: %s' , 'customizr' ), '<span>' . get_the_date( _x( 'Y' , 'yearly archives date format' , 'customizr' ) ) . '</span>' ) : $archive_type;
                $content        = sprintf('<h1 class="%1$s">%2$s</h1>',
                  apply_filters( 'tc_archive_icon', 'format-icon' ),
                  $archive_type
                );
    	}
    	return $content;
    }

    Thread Starter kupili

    (@kupili)

    Thank you. You are the best. Works like a charm.

    Glad that it works. Can you mark this post as resolved?

    Thread Starter kupili

    (@kupili)

    I did it now. Thanks again.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change title of archives’ is closed to new replies.