Bug: 'read more' buttons – filters in code
-
Hi
I noticed this bug in the latest stable version of Graphene.
When you manually set the ‘more’ tags in your posts you can set graphene to only display the excerpts on the homepage. Now, the problem: graphene only displays the ‘read more’ button only in these cases:
-the excerpt is too long
-there is no ‘more’ tag, so the excerpt is auto-generated
Graphene also has an option to display the ‘read more’ button when you have set your excerpt manually. This one doesn’t work. So the ‘read more’ button is not shown in this case:
-the excerpt is manually set and has a good length (not too long)
Debugging:
-the setting is stored in the database and I think graphene also reads it well
-I think the problem is a missing or wrong filter:
if (!function_exists('graphene_continue_reading_link')) :
function graphene_continue_reading_link() {
global $in_slider;
if (!is_page() && !$in_slider) {
$more_link_text = __('Continue reading »', 'graphene');
return '</p><p><a href="'.get_permalink().'">'.$more_link_text.'</a>';
}
}
endif;
function graphene_auto_excerpt_more($more) {
return apply_filters('graphene_auto_excerpt_more', ' … '.graphene_continue_reading_link());
}
add_filter('excerpt_more', 'graphene_auto_excerpt_more' );
function graphene_manual_except_more($text){
global $in_slider;
if (has_excerpt() && !$in_slider){
$text = explode('</p>', $text);
$text[count($text)-2] .= graphene_continue_reading_link();
$text = implode('</p>', $text);
}
return $text;
}
if ($graphene_settings['show_excerpt_more']) {
add_filter('the_excerpt', 'graphene_manual_except_more');
}edit: fixing the typos (except/excerpt) didn’t help.
Admin
Thanks for the heads up on the typo!
However, I can’t seem to reproduce the bug you mentioned. It works just fine when Itried with these settings:
1. Show excerpts on front page
2. Give a post a manual excerpt (tried both long and short excerpts)
3. Enable Read More link for manual excerpts
Hi
I found the problem:
I never really created excerpts, I always use a “read more” link in my posts. So I guess I have to look for a plugin that converts the text before the “read more” link in an excerpt.
Sam
PS: I found out with the has_excerpt(). It always returns false.
edit: not as simple as I thought
So…
FEATURE REQUEST: option to always show “read more” button on some pages like archives, home…
Admin
has_excerpt() will only return true if the post has a manual excerpt. Else it’llr eturn false.
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
