We're merging with GenerateBlocks! Learn more here.

[Resolved] Displaying read more button with read more tag

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Displaying read more button with read more tag

Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #5408
    Janek
    Participant

    Good evening, just wondering if there is a way to show the read more button only when using the read more tag within a post. For instance I have a page for team member profiles, one member might have a lot more they want to say about themselves but I dont want their post to take up too much room so Ill use the read more tag to cut their content off. However when I do this a read more button isnt displayed in the WP Show Posts list.

    The alternative is I put on excerpts, but this just seems to add the read more button for everyone, even the people who dont have more content.

    #5423
    Tom
    Keymaster

    Hey Janek,

    You should be able to:

    1. Turn off the default read more button.

    2. Add this function:

    add_filter( 'the_content_more_link', 'tu_wpsp_content_more', 15 );
    function tu_wpsp_content_more( $more ) {
    	return sprintf( '<div class="wpsp-read-more"><a title="%1$s" class="read-more content-read-more" href="%2$s">%3$s%4$s</a></div>',
    		the_title_attribute( 'echo=0' ),
    		esc_url( get_permalink( get_the_ID() ) ),
    		'Read more',
    		'<span class="screen-reader-text">' . get_the_title() . '</span>'
    	);
    }

    Let me know if this works or not 🙂

    #5427
    Janek
    Participant

    Hey Tom, I’m having no luck with this.

    I have tried a couple of combinations of settings on the WP Show Posts content option, I set it to none, full and excerpt and havent been able to get it to work. Would it be easier if I gave you a temp login for the site?

    I have the code running as a snippet and I can give you its name and the name of the list and page it features on.

    #5438
    Tom
    Keymaster

    Sure, send over some login details and I’ll take a look 🙂

    #5439
    Janek
    Participant

    Hey Tom, I’ve sent the details to support@generatepress.com hope thats ok?

    The snippet you are looking for is called:
    Read More Tag WP Show Posts Button

    Should be at the bottom of the list in snippets.

    #5457
    Janek
    Participant

    The site url has changed to:
    http://staging.janek-dev.flywheelsites.com/wp-admin

    I’ve been moving things around in order to be ready to deploy the site in 2 days.

    #5461
    Tom
    Keymaster

    Looking at the code again, I’m not sure it’s the best solution, as it would apply to every WordPress post (not just WPSP).

    This may be something I need to work into the plugin itself.

    #5462
    Janek
    Participant

    No worries, Tom. I’m happy to just shelve this one for the moment. I’ve spoken to the client and asked if we can forgo that functionality and they are ok with it.

    Thanks for looking to this for me.

    #5491
    Tom
    Keymaster

    No problem!

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