Viewing 3 replies - 1 through 3 (of 3 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    Something like that should do it:

    add_filter( 'excerpt_length', function( $length ) {
        // Category archives.
        if ( is_category() ) {
            return 0;
        }
    
        // Tag archives.
        if ( is_tag() ) {
            return 5;
        }
    
        // Homepage blog.
        if ( is_home() ) {
            return 10;
        }
    
        return $length;
    }, 1000 );

    Let me know ??

    Thread Starter flushdrew

    (@flushdrew)

    Perfect, thank you.

    It works with the parent theme but not a child thème.

    Theme Author Tom

    (@edge22)

    Adding it to the parent theme means you’ll lose it when you update. There shouldn’t be a difference between child and parent theme when it comes to code execution.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change excerpt lenght between tag, category and home’ is closed to new replies.