Site logo

Archived topic

category page template

5 replies · Started by David on June 8, 2022

Viewing posts 1–6 of 6

- I can't find the template for the category layout. It's not under elements. Hence, I can't change the design of the blog/ category page.
Using the blog templates VOLUME

- Japanese language doesn't work for blog post excerpts (instead of 20 characters it shows the entire blog post). Any solution for this?

Hi David,

– I can’t find the template for the category layout. It’s not under elements

It's using 2 block element - content template, you can find them at appearance > elements.
https://www.screencast.com/t/rFGhS1vh

– Japanese language doesn’t work for blog post excerpts (instead of 20 characters it shows the entire blog post)

I'm aware that WordPress excerpts word count is incorrect in some languages, but GP has no control over it Unfortuanly.

The article you linked says the issue stems if we’re no using the native the_excerpt() tag but we’re actually using it to retrieve the excerpt: https://github.com/tomusborne/generatepress/blob/adfe090929b0515cdf894f4c6b722cfe8c0790dc/content.php#:~:text=%3Fphp%20the_excerpt()%3B%20%3F%3E

Moreover, to clarify first, are you using the custom excerpt field or a WP read more Block?: https://share.getcloudapp.com/BluGBYey

If you use either of this, the excerpt count in the Customizer wont work on the specific posts using either.

To change the excerpt from word to character count, you can try this PHP snippet:

add_filter( 'the_excerpt', function( $excerpt ) {
    $excerpt = substr( $excerpt, 0, 200 );

    $button = sprintf( '<p class="read-more-container"><a title="%1$s" class="read-more content-read-more button" href="%2$s">%3$s%4$s</a></p>',
        the_title_attribute( 'echo=0' ),
        esc_url( get_permalink( get_the_ID() ) . apply_filters( 'generate_more_jump','#more-' . get_the_ID() ) ),
        __( 'Read more', 'gp-premium' ),
        '<span class="screen-reader-text">' . get_the_title() . '</span>'
    );

    return $excerpt . $button;
} );

Kindly replace 200 with the character count you prefer.

Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets

Kindly let us know how it goes!

THANK YOu will give this a try.
I am using one of your templates called VOLUME

ONE LAST QUESTION:
can I make my own blog archive page in ELEMENTS? to do my own category layout? If yes, can you point me to the documentation part. Cheers, David

This archived topic is closed to new replies.