• Hello All –

    I’m trying to list excerpts from a certain post category and modify the automatically generated link to the post (“Continue Reading ->’).

    I’ve read through the same snippet and tried it so many times, which is something like:

    function new_excerpt_more($more) {
           global $post;
    	return '... <a href="'. get_permalink($post->ID) . '">More...</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    But I can’t get it to work. It might have to do with the way I’m pulling the excerpts. The code I’m using follows:

    <ul>
    <?php // need to set link to posts page
    global $post;
    $args = array( 'numberposts' => 2, /*'offset'=> 1,*/ 'category' => 3 );
    $myposts = get_posts( $args );
    foreach( $myposts as $post ) :	setup_postdata($post); ?>
    	<li><h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3><?php the_excerpt();?></li>
    <?php endforeach; ?>
     </ul>

    Any help greatly appreciated!

The topic ‘excerpt change more text’ is closed to new replies.