Home › Forums › Pro Support › Read More Only if There’s a More Block
- This topic has 7 replies, 2 voices, and was last updated 2 years, 3 months ago by Tom.
November 25, 2020 at 6:37 am #23029
Hi, I’m hoping you can help.
I’ve set up a WP Show Posts list with Content Type set to “Full”.
When editing my posts, I include a More Block to determine where to cut off the post and display the “Read More” link in WP Show Posts. That works perfectly, but for very short posts I don’t want to include a More Block; I just want to display the entire post. The whole post is displayed by WPSP but there is a “Read More” link at the bottom, which doesn’t really make sense as there is no more content to read.
Is there a way I can show the “Read More” link only for posts that have a More Block, please?November 27, 2020 at 12:09 pm #23184
Tricky one (although it shouldn’t be).
Out of curiosity, what happens if you:
1. Disable the read more button in your list.
2. Add this snippet:
remove_filter( 'excerpt_more', 'wpsp_excerpt_more', 999 );
Anything at all?November 28, 2020 at 6:21 am #23304
That doesn’t seem to have done anything unfortunately.
I just have no read more buttons now.
The GeneratePress category archive is fine – the posts with More Blocks in have buttons and the ones without don’t. But the WP Show Posts list seems to have to either have a button or not have a button for all posts regardless of whether they are displaying the full content, or the full content up as far as a More Block.
It’s not urgent. Maybe you could have another think after the weekend.December 1, 2020 at 10:45 am #23525
Hmm, any chance you can link me to a GP archive that has the functionality you want, and to the WPSP archive that’s missing it? It might give me an idea 🙂December 1, 2020 at 11:11 am #23546
The Latest News here https://buckbylibraryhub.org/ is a WP Show Posts List picking up the category “Featured News”.
Then, this is the category archive https://buckbylibraryhub.org/category/featured-news/
I am using the generate_more-jump filter to make “read more” go to the top of the blog post, but I wouldn’t have thought that would be relevant. Just mentioning in case.December 2, 2020 at 12:29 pm #23649
Can you update to our development version and then try the filter below?: https://wpshowposts.com/wp-show-posts-1-2-0/
add_filter( 'wpsp_content_more_link', '__return_null' );
Any difference at all?December 3, 2020 at 7:21 am #23703
Thanks, Tom. It looks like that might have done the trick!
I’ve put the alpha version on a test site, added the filter and then removed the “Read More” text from the WP Show Posts list.
I now have the behaviour I was looking for. 🙂 As at today, you can see it here on my very ugly test site https://sandbox.janeb.co.uk/ although that page will not stay like that for long.
I’ll probably hold off installing it on the live site for now, but it’s good to know a solution is on it’s way.
Thank you for looking into this.December 4, 2020 at 2:00 pm #23780
It’s likely more of a beta than an alpha at this point – haven’t found many issues. Plan on pushing out the official version early 2021 🙂
- You must be logged in to reply to this topic.