Is there a way I can add some kind of pre_get_posts()
filter to strip out the “read more” link that appears at the end of the_excerpt()
for only 1 certain custom post type that I specify?
If so, can someone please help me out with the code? I’ve been working at it for a while but haven’t gotten anywhere. Any help would be greatly appreciated. Thanks!
I fixed this by adding the below to functions.php
Courtesy of Remove more or […] text from short post
Put the following code in
functions.php
to show “read more” on all post types exceptcustom_post_type
.An easy solution is to put following code inside
style.css
:This targets
<a class="read-more">
What about this? Basically it’s a way to customize the text by adding a callback function to the functions.php file. I’m thinking, however, if you just return a space instead, then it should override it and not display anything.
I got this from The WordPress codex
Edit:
This is untested, but what if you do this:
To reiterate, I haven’t tested this, but may get you on the right track (i.e. var_dump($post) to see how you can bend it to your will from within the new_excerpt_more function.