Home › Forums › Pro Support › Displaying read more button with read more tag
Tagged: read more
- This topic has 8 replies, 2 voices, and was last updated 5 years, 1 month ago by
Tom.
-
AuthorPosts
-
July 25, 2018 at 4:30 am #5408
Janek
ParticipantGood 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.
July 26, 2018 at 9:10 pm #5423Tom
KeymasterHey 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 🙂
July 26, 2018 at 9:36 pm #5427Janek
ParticipantHey 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.
July 27, 2018 at 6:00 pm #5438Tom
KeymasterSure, send over some login details and I’ll take a look 🙂
July 27, 2018 at 6:21 pm #5439Janek
ParticipantHey 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 ButtonShould be at the bottom of the list in snippets.
July 29, 2018 at 4:27 am #5457Janek
ParticipantThe site url has changed to:
http://staging.janek-dev.flywheelsites.com/wp-adminI’ve been moving things around in order to be ready to deploy the site in 2 days.
July 29, 2018 at 6:04 pm #5461Tom
KeymasterLooking 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.
July 29, 2018 at 6:09 pm #5462Janek
ParticipantNo 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.
July 30, 2018 at 8:58 pm #5491Tom
KeymasterNo problem!
-
AuthorPosts
- You must be logged in to reply to this topic.