[Support request] Read More formatting in RSS feed with Manual Excerpt

Home Forums Support [Support request] Read More formatting in RSS feed with Manual Excerpt

Home Forums Support Read More formatting in RSS feed with Manual Excerpt

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #1454660
    Alexander

    Hi,

    about a year ago you helped me with some Code Snippets to always use the Manual Excerpt together with the Read More button, and this all works quite well (for reference: https://generatepress.com/forums/topic/manual-excerpt-is-ignored/)

    Recently (after I switched my “follow by email” functionality away from Jetpack to a Mailchimp automation using the RSS feed) I notice that, when I do have a Manual Excerpt, the formatting is a bit mangled.

    Namely, the text “Read More” and the linked post title are concatenated into one, like “Read MorePost Title”. This wouldn’t seem like a big deal, but in the emails (they’re based on the RSS feed item), the link doesn’t work (maybe because it contains the “#more” thing?).

    Here’s my RSS feed, which contains items without and with a Manual Excerpt:
    https://www.alex-kunz.com/feed/

    Any help on where to look and how to fix this would be appreciated.

    Thanks!
    Alex.

    #1455764
    Tom
    Lead Developer
    Lead Developer

    Hi Alex,

    Any chance you’re willing to try out 3.0-beta?: https://generatepress.com/generatepress-3-0-a-new-era/

    I believe this issue is fixed in that version.

    Let me know πŸ™‚

    #1455771
    Alexander

    Thanks, Tom. Unfortunately, I don’t have a test/staging site.

    If 3.0 final isn’t too far away anymore I’ll just wait.

    #1455784
    Tom
    Lead Developer
    Lead Developer

    We’re about 2 weeks away from the final version. Can you share the excerpt-related functions you’re using at the moment?

    #1455820
    Alexander

    Sure.

    First one, to use the Manual Excerpt over the automatic one:

    add_filter( 'generate_show_excerpt', function( $excerpt ) {
        if ( has_excerpt() ) {
            return true;
        }
        return $excerpt;
    } );

    Second one, to add the Read More button to the Manual Excerpt:

    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">%3$s</a></p>',
                $excerpt,
                get_permalink(),
                __( 'Read more', 'generatepress' )
            );
        }
    	
        return $output;
    }

    Thanks!
    Alex.

    #1456118
    Tom
    Lead Developer
    Lead Developer

    I think updating to 3.0 is your best bet, but you can try this:

    add_filter( 'generate_content_more_link_output', function() {
        return sprintf(
            '<p class="read-more-container"><a title="%1$s" class="read-more content-read-more" href="%2$s" aria-label="%4$s">%3$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', 'generatepress' ),
            sprintf(
                /* translators: Aria-label describing the read more button */
                _x( 'More on %s', 'more on post title', 'generatepress' ),
                the_title_attribute( 'echo=0' )
            )
        );
    }, 50 );
    #1456210
    Alexander

    Thank you, Tom – just to make sure, this is an additional code snippet and doesn’t replace the existing ones, right?

    #1457269
    Tom
    Lead Developer
    Lead Developer

    That’s correct – it’s the default in 3.0, so you can remove it when you choose to update.

    #1480392
    Alexander

    Hello Tom,

    I updated to GP3 now, but find the behavior of the Read More/Manual Excerpt connection unchanged, ie. I still need to have both of the Code Snippets that I pasted above active in order to a) get my Manual Excerpt over the auto-excerpt, and b) see the Read More button when this Manual Excerpt override is active.

    The RSS feed also still shows the Read MorePost Title concatenation for those articles that do NOT have a Manual Excerpt set.

    Am I missing some new setting or something?

    Thanks
    Alex.

    #1480907
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Looks like we need to update the function in GP Premium as well to use aria-label instead of screen reader text.

    wp_trim_excerpt will likely always be necessary – this isn’t something we can introduce without affecting existing sites.

    What is the generate_show_excerpt filter doing, exactly?

    #1481057
    Alexander

    Hello Tom, you gave me that filter in your message https://generatepress.com/forums/topic/manual-excerpt-is-ignored/#post-992403 πŸ˜‰

    #1481120
    Tom
    Lead Developer
    Lead Developer

    Right, so it’s to overwrite the more tag functionality.

    All of this is still necessary (minus the screen-reader-text thing, which we’ll fix in GPP).

    #1481127
    Alexander

    If the screen-reader-text thing is what will fix the “Read MorePost Title” thing in the RSS feed then that’ll make me happy. πŸ™‚

    Thanks.

    #1482272
    Tom
    Lead Developer
    Lead Developer

    No problem – sorry that it slipped by πŸ™‚

    #1655716
    Alexander

    Hello Tom & support team,

    it’s been a while and unfortunately, the bug with the formatting of the “Read More” link in RSS still exists… I understand that this isn’t a high priority thing but figured I’d post a gentle nudge. πŸ˜›

    Cheers
    Alex.

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