Archived topic
Editing 'read more' link earns WSD (white screen of death)
3 replies · Started by Martin on March 4, 2019
Hello. This is my first post here as I find so much useful answers I've not needed to post before.
I was researching how to make nicer 'read more' links and links on blog post titles - without the yukky /#more- bit on the end of the URL and found some useful PHP snippets within the answers in this forum. however, after installing GPP, the snippets gave me a WSD (the dreaded White Screen of Death).
Although I hadn't got to exactly what I wanted with the 'more' links, this is the code I was using (written by Tom):
add_action( 'after_setup_theme','tu_remove_read_more' );
function tu_remove_read_more() {
remove_filter( 'excerpt_more', 'generate_blog_excerpt_more', 99 );
remove_filter( 'the_content_more_link', 'generate_blog_content_more', 99 );
}
add_filter( 'excerpt_more', 'tu_blog_excerpt_more', 99 );
function tu_blog_excerpt_more( $more ) {
if ( ! function_exists( 'generate_blog_get_defaults' ) )
return;
$generate_settings = wp_parse_args(
get_option( 'generate_blog_settings', array() ),
generate_blog_get_defaults()
);
// If empty, return
if ( '' == $generate_settings['read_more'] )
return;
return '... ' . $generate_settings['read_more'] . '';
}
add_filter( 'the_content_more_link', 'tu_blog_content_more', 99 );
function generate_blog_content_more( $more ) {
if ( ! function_exists( 'generate_blog_get_defaults' ) )
return;
$generate_settings = wp_parse_args(
get_option( 'generate_blog_settings', array() ),
generate_blog_get_defaults()
);
// If empty, return
if ( '' == $generate_settings['read_more'] )
return;
$more_jump = apply_filters( 'generate_more_jump','#more-' . get_the_ID() );
return '<p class="read-more-container">' . $generate_settings['read_more'] . '</p>';
}
After removing bits of the code, it turns out the last section is the bit causing the WSD.When I remove
add_filter( 'the_content_more_link', 'tu_blog_content_more', 99 );
function generate_blog_content_more( $more ) {
if ( ! function_exists( 'generate_blog_get_defaults' ) )
return;
$generate_settings = wp_parse_args(
get_option( 'generate_blog_settings', array() ),
generate_blog_get_defaults()
);
// If empty, return
if ( '' == $generate_settings['read_more'] )
return;
$more_jump = apply_filters( 'generate_more_jump','#more-' . get_the_ID() );
return '<p class="read-more-container">' . $generate_settings['read_more'] . '</p>';
}
the WSD is no more...
But now my read more link is as it was before, containing the yukky /#more-nn
Anyone managed to create a nice 'read more' link in GPP?
Thanks.
Martin
Hi there,
It's actually quite easy to remove the #more part, you just need to do this:
add_filter( 'generate_more_jump', '__return_empty_string' );
Wow that is much easier.
How can I change 'Read more' to 'Read the full article'?
Thanks Tom.
You can do that in Customize > Layout > Blog :)