Hello,
I have a custom post type called 'services' and on the archive page I'm showing the_excerpt() and for some odd reason it's showing a 'Continue reading' link in the excerpt paragraph. I can not figure out how to remove this link.
Here is a link to the beta site: http://beta.gastownphysiopilates.com/services/
I have these two functions in my functions.php file but they don't seem to have any effect over this particular excerpt. Though, these functions do affect the index.php excerpts.
Functions:
// CUSTOM EXCERPT LENGTH
function custom_excerpt_length($length) {
return 50;
}
add_filter('excerpt_length', 'custom_excerpt_length');
// CUSTEM EXCERPT ELLIPSES
function new_excerpt_more($more) {
return '...';
if ( 'services' == get_post_type() ) {
return "";
}
}
add_filter('excerpt_more', 'new_excerpt_more');
Thanks for the help.
Daniel Yoen answers:
Please try this in loop :
<?php the_content('',FALSE,''); ?>
Hope this help :-)
Denis Leblanc comments:
That wouldn't help anything cause I'm using the_excerpt() in my loop. Thanks though.
Denis Leblanc comments:
That wouldn't help anything cause I'm using the_excerpt() in my loop. Thanks though.
Takanakui answers:
Hi Denis,
Replace your new_excerpt_more function by this version.
I changed the way to get the post type inside the loop.
// CUSTEM EXCERPT ELLIPSES
function new_excerpt_more($more) {
return '...';
if ( 'services' == get_post()->post_type ) {
return "";
}
}
Best Regards,
Takanakui
Denis Leblanc comments:
That didn't do anything. As I've mentioned above, this function doesn't seem to affect this particular excerpt. Even if I was to remove the 'services' conditional it would not affect it. However, I know this custom excerpt more function work because it affects the blog posts here: http://beta.gastownphysiopilates.com/resources/
Takanakui comments:
Could be because of the priority of the filter, I changed the priority (last line of the code)
I also switched the "if statement" to be before the return because that way the code was unreachable because it was always returning.
// CUSTEM EXCERPT ELLIPSES
function new_excerpt_more($more) {
if ( 'services' == get_post()->post_type ) {
return "";
}
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more',100);
Best Regards,
Takanakui
Denis Leblanc comments:
Still not happening.
Navjot Singh answers:
Try this
function new_excerpt_more($more) {
global $post;
if ( 'services' == get_post_type($post->ID) ) {
return "";
}
return '...';
}
instead of the new_excerpt_more function you are using above.
Denis Leblanc comments:
This still doesn't work.
Arnav Joy answers:
try this
function new_excerpt_more($more) {
wp_reset_query();
global $post;
if ( 'services' == $post->post_type ) {
return "";
}
else
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
Denis Leblanc comments:
This doesn't work either.