Archived topic
Read More not displaying after writing Excerpt.
32 replies · Started by Jesus Higuerey on July 24, 2018
Hello there, I've added text to the post, deleted the excerpt and now it seems to be working.
So just to be clear, if I write an excerpt the read more button won't appear?
It should be if you have the second block of code added:
https://docs.generatepress.com/article/activating-read-custom-excerpt/
Well the button is there is just if I write the excerpt it doesn't appear which makes no sense to me atm
When you use the custom excerpt metabox, WordPress assumes that you want the full excerpt to show - hence there isn't the read more link.
The article I linked will force read more to show even if you are using custom excerpt.
Take a look at the first 2 sentences on that article.
Well it doesn't seem to work then.. I have the code in a snippet since the beginning though ...
I can see read more link showing here when you were using the custom excerpt so something is working:
https://gyazo.com/6050e4798a1ae99def6bd45349cfed1c
Are you sure you added the second block for the button and not the first block?
https://docs.generatepress.com/article/activating-read-custom-excerpt/
With that post custom excerpt is not enabled .. It is what I'm trying to say, if I add custom excerpt the button goes away. And yes I have the code you mentioned, I can give you an username and password if you would like to take a look :)
Custom excerpt was enabled in the video (aka you were using the excerpt metabox) which is why the options aren't working in your video and I was seeing different content in single post page:
https://gyazo.com/6050e4798a1ae99def6bd45349cfed1c
https://www.screencast.com/t/B6C8m84E6XiD
Yeah in the video it was enabled. But you said that even if I have an custom excerpt it should show the button which it doesn't
It showed the "Read More" link (by default it shouldn't show that) which is what the first block of code does, if you add the second block of code then it should be a button:
https://docs.generatepress.com/article/activating-read-custom-excerpt/
Yeah like I said before, I have the code you mentioned, but I want to be able to create a custom excerpt without the button disappearing.. which is what's happening right now .. Custom excerpt = button disappears, having the code you mentioned.
Can you write a custom excerpt again?
Please check, my excerpt is currently at 20 words, which it now clearly more than that..
Right so now the only problem is that it's a read more link and not a read more button?
https://www.screencast.com/t/gA8JqJEtLX
Can you copy and paste you are using here? be sure to highlight the code and click <code>
It doesn't really matter tbh I actually prefer the link instead of the button, rather fix why the excerpt is so long, it should've stopped at 20 words.
add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
function tu_excerpt_metabox_more( $excerpt ) {
$output = $excerpt;
$settings = wp_parse_args(
get_option( 'generate_blog_settings', array() ),
generate_blog_get_defaults()
);
if ( has_excerpt() ) {
$output = sprintf( '%1$s <a href="%2$s">%3$s</a>',
$excerpt,
get_permalink(),
wp_kses_post( $settings['read_more'] )
);
}
return $output;
}