Removing read-more from excerpt (responsive theme)
-
Hi,
I’ve been looking around the forums both here and at cyberchimps, but am struggling to edit/remove the read-more link to specific posts produced by category blogroll templates. I’m using the free responsive theme, but trying to intervene via a child theme.I’ve identified the call to get the except which is simply;
<?php the_excerpt(); ?>
in my child version of a category template copied from the original template.I’ve identified in the responsive themes own functions where the read-more button is created:
[ Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin ]
function responsive_read_more() { return '<div class="read-more"><a href="' . get_permalink() . '">' . __( 'Read more ›', 'responsive' ) . '</a></div><!-- end of .read-more -->'; } /** * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and responsive_read_more_link(). */ function responsive_auto_excerpt_more( $more ) { return '<span class="ellipsis">…</span>' . responsive_read_more(); } add_filter( 'excerpt_more', 'responsive_auto_excerpt_more' ); What I am trying to change via my child functions is the below. Basically I'd like it to check if this is happening in a specific category and not show a read-more button. function responsive_child_read_more() { if ( in_category('sound-news') ) { // do not show a read more button!!! } else { return '<div class="read-more"><a href="' . get_permalink() . '">' . __( 'Read more ›', 'responsive' ) . '</a></div><!-- end of .read-more -->'; } } What is the best way to do this? So far I've only had limited success using: add_action('after_setup_theme', 'child_read_more_filter'); function child_read_more_filter() { add_filter('the_excerpt','responsive_child_read_more'); }…BUT – This removes the excerpt entirely, while
add_filter('excerpt_more'...achieves nothing.
Any help – greatly appreciated.
[ Please do not bump, that’s not permitted here. ]
The topic ‘Removing read-more from excerpt (responsive theme)’ is closed to new replies.