admin管理员组文章数量:1026989
in this page /
Last post is with excerpt.
If my posts don´t have excerpt show read more If I add excerpt the button doesn´t show.
In functions.php
// Replaces the excerpt "Read More" text by a link
function clean_blogging_excerpt_more($more) {
if ( is_admin() ) {
return $more;
}
global $post;
return '<p><a class="readmore" href="'. get_permalink($post->ID) . '">Leer Más</a></p>';
}
add_filter('excerpt_more', 'clean_blogging_excerpt_more');
in this page https://blog.despierta/page/3/
Last post is with excerpt.
If my posts don´t have excerpt show read more If I add excerpt the button doesn´t show.
In functions.php
// Replaces the excerpt "Read More" text by a link
function clean_blogging_excerpt_more($more) {
if ( is_admin() ) {
return $more;
}
global $post;
return '<p><a class="readmore" href="'. get_permalink($post->ID) . '">Leer Más</a></p>';
}
add_filter('excerpt_more', 'clean_blogging_excerpt_more');
Share
Improve this question
edited Mar 22, 2019 at 14:10
cjbj
15k16 gold badges42 silver badges89 bronze badges
asked Mar 22, 2019 at 13:18
En Código WPEn Código WP
213 bronze badges
1 Answer
Reset to default 1You are using the wrong filter. Depending on how your theme is built, there may be two solutions.
If the theme uses the
wp_trim_excerpt
function, theexcerpt_more
filter inside that function will only be called if there is no excerpt passed to that function. At the end of that function there still is thewp_trim_excerpt
filter that you could use to append anything to the result.If the theme uses the
get_the_excerpt
function to echo the excerpt there is a filter with the same name that you may use.
Both solutions may work at the same time, so don't overdo it.
in this page /
Last post is with excerpt.
If my posts don´t have excerpt show read more If I add excerpt the button doesn´t show.
In functions.php
// Replaces the excerpt "Read More" text by a link
function clean_blogging_excerpt_more($more) {
if ( is_admin() ) {
return $more;
}
global $post;
return '<p><a class="readmore" href="'. get_permalink($post->ID) . '">Leer Más</a></p>';
}
add_filter('excerpt_more', 'clean_blogging_excerpt_more');
in this page https://blog.despierta/page/3/
Last post is with excerpt.
If my posts don´t have excerpt show read more If I add excerpt the button doesn´t show.
In functions.php
// Replaces the excerpt "Read More" text by a link
function clean_blogging_excerpt_more($more) {
if ( is_admin() ) {
return $more;
}
global $post;
return '<p><a class="readmore" href="'. get_permalink($post->ID) . '">Leer Más</a></p>';
}
add_filter('excerpt_more', 'clean_blogging_excerpt_more');
Share
Improve this question
edited Mar 22, 2019 at 14:10
cjbj
15k16 gold badges42 silver badges89 bronze badges
asked Mar 22, 2019 at 13:18
En Código WPEn Código WP
213 bronze badges
1 Answer
Reset to default 1You are using the wrong filter. Depending on how your theme is built, there may be two solutions.
If the theme uses the
wp_trim_excerpt
function, theexcerpt_more
filter inside that function will only be called if there is no excerpt passed to that function. At the end of that function there still is thewp_trim_excerpt
filter that you could use to append anything to the result.If the theme uses the
get_the_excerpt
function to echo the excerpt there is a filter with the same name that you may use.
Both solutions may work at the same time, so don't overdo it.
本文标签: filtersWhy in archive page doesn180t show read more button with excerpt
版权声明:本文标题:filters - Why in archive page doesn´t show read more button with excerpt? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745665578a2162156.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论