Site logo

Archived topic

Changing the string in "read more" button in different categories

1 reply · Started by Mohammed on September 5, 2019

Viewing posts 1–2 of 2

Hello
I would like to change the string on "read more" button based on which category you are viewing.
Based on my use case, I would like to show "read more" in resources page/category and to show "take the quiz!" in quizzes page/category
How is that possible?
Thanks

Hi there,

You can use this filter:
https://docs.generatepress.com/article/option_generate_blog_settings/#options-%E2%80%98read_more%E2%80%99
https://codex.wordpress.org/Conditional_Tags#A_Category_Page

So the code would be something like this:

add_filter( 'option_generate_blog_settings', function( $options) {
    if ( is_category( 'CATEGORY_NAME' ) ) {
        $options['read_more'] = 'My custom read more label';
    }
    return $options;
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Let me know if this helps :)

This archived topic is closed to new replies.