[Resolved] No "Read More" buttons

Home Forums Support [Resolved] No "Read More" buttons

Home Forums Support No "Read More" buttons

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #465751
    Edin

    I wonder why I don’t have any “Read More” buttons below every article in the homepage posts view?

    I have activated “Display read more as button” under Layout / Blog in the customizer.

    Thank you!

    #465983
    Leo
    Staff
    Customer Support
    #472003
    Edin

    Thank you Leo, but curiously that didn’t work for me.

    Any other idea?

    #472371
    Leo
    Staff
    Customer Support

    Hmm it should work. How did you add it?

    #472410
    Edin

    I added the code to my functions.php.

    #472875
    Tom
    Lead Developer
    Lead Developer

    Can you try deactivating your other plugins to see if one of them is altering the excerpt?

    #480949
    Edin

    I’ve added the code again to the live site and it worked.

    But it added a “Read More” text link right at the end of the excerpt, not the button?

    It’s not a big deal, though…

    #481230
    Tom
    Lead Developer
    Lead Developer

    To turn it into a button, use this instead:

    add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
    function tu_excerpt_metabox_more( $excerpt ) {
    	$output = $excerpt;
    	
    	if ( has_excerpt() ) {
    		$output = sprintf( '%1$s <p class="read-more-button-container"><a class="button" href="%2$s">Read more</a></p>',
    			$excerpt,
    			get_permalink()
    		);
    	}
    	
    	return $output;
    }
    #483281
    Edin

    Thank you Tom. That worked perfectly!

    #483719
    Tom
    Lead Developer
    Lead Developer

    You’re welcome ๐Ÿ™‚

    #484274
    Olivier

    Hello
    I have the same problem, I have tested everything as indicated and nothing changes.
    My site is in development, not online.

    I have a actived the excerpt with a text, but in my page Blog, the excerpt no appear, just my full text.

    I use a theme child and I have test with the two codes in the function.php, nothing change.

    Thank you for your help

    WP 4.9.2
    GP Premium 1.5.6
    Elementor Free 1.9.3

    #484608
    Leo
    Staff
    Customer Support

    Can you make sure excerpt is turned on? https://docs.generatepress.com/article/blog-content-layout/#archives

    If yes we would need to see the live site unfortunately.

    #484684
    Olivier

    OOOH thank you Leo :p
    I must learn this theme.

    So I have a problem this option, she dont change the words.

    null

    #484766
    Leo
    Staff
    Customer Support

    Are you using Tom’s code here? https://generatepress.com/forums/topic/no-read-more-buttons/#post-481230

    If so you need to actually change the “Read more” in the code.

    #485122
    Olivier

    pffff… yes… ^^

    Thank you ๐Ÿ™‚

    It’s possible to use the real code for “read_more” instead of changing the text in function.php ?

Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.