Excerpt more link to category not single page
-
Hi
Is anyone able to tell me how I can get the more link in the excerpt to link through to the posts pages not the single page?
I have a category called Testimonials and want to display an excerpt of random testimonials on the home page in the sidebar with a read more that links back to the Testimonials post page where ALL the testimonials are. Currently the read more link takes you to a single page of the excerpt.
My code is as follows (sorry not sure why wont go in code box):
`<?php
$posts = get_posts(‘category_name=Testimonials&numberposts=1&orderby=rand’);
foreach ($posts as $post) : start_wp(); ?><h2><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<?php
endforeach;
?>;`and the function is:
<?php function remove_more_jump_link($link) { $offset = strpos($link, '#more-'); if ($offset) { $end = strpos($link, '"',$offset); } if ($end) { $link = substr_replace($link, '', $offset, $end-$offset); } return $link; } add_filter('the_content_more_link', 'remove_more_jump_link'); function excerpt_ellipse($text) { return str_replace('[...]', ' <a href="'.get_permalink().'"> more...</a>', $text); } add_filter('the_excerpt', 'excerpt_ellipse'); ?>
Please note that I have other read mores that should link to the single page.
Thank you so much.
- The topic ‘Excerpt more link to category not single page’ is closed to new replies.