Im trying to do an if/else on a custom excerpt filter in functions.php file but not having any luck. Heres what I have. What I am trying to do is customize one of the excerpts being generated. I need to have 'Watch Video' instead of the read more for one post. I tried wrapping that in an if (is_single('my page')) but it doesn't have any affect. Any help anyone could provide would be greatly appreciated!
thanks!
function custom_excerpt($text) {
$excerpt = '' . strip_tags($text) . '<span class="readmore"><a href="'.get_the_permalink().'" rel="nofollow">Read More »</a></span>';
return $excerpt;
}
add_filter('the_excerpt', 'custom_excerpt');
is_single( 'my page' )
will return true if my page is a single post, even if you're not on 'my page', in the same way that is_building('house') will always return true, even if you're currently on a lake, you want to check that the current post is 'my page', not that 'my page' is a pagethe_content_more_link
filter, look at the documentation on the dev handbook forthe_excerpt
for an example