• Hi,
    I’ve modified Starker’s bare wordpress theme in order to create a website. This is my first time creating a site through wordpress however I’ve found it pretty straight forward…except for one issue that’s really just stumping me. The ‘continue reading’ text that inserts itself when using the manual excerpt function in the posts. I can’t get rid of it.
    I can’t get the <!–more–> text to work I think mostly because I’m pulling posts by category onto several different pages which is why I switched from the_content() to the_excerpt()
    Here’s what I’ve tried so far:
    I’ve removed any <!–more–> tags in my posts
    I’ve looked through every file I can think of and cannot find a single reference to the_excerpt(‘continue reading’) anywhere, in fact, I can’t find the words ‘continue reading’ in any file.
    Here is my code:

    <?php
    query_posts('cat=3');
    if (have_posts()) : while (have_posts()) : the_post();?>
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    		<?php the_excerpt(); ?>
    	<?php
    endwhile; endif;
    wp_reset_query();
    ?>

    I’ve tried it with span tags in between the () with no luck. I’m at the end of my brainstorming, I’ve searched this site and others high and low and have tried everything they’ve suggested with no luck. Any help or insights would be greatly appreciated.
    Thanks.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter synchole

    (@synchole)

    Yes, both the functions.php in my wp-includes folder and the functions in my theme folder, the first one broke my site completely so I decided not to mess with that file any more and the second one made no difference what so ever.

    this is in functions.php of the theme:

    /**
     * Adds a pretty "Continue Reading" link to custom post excerpts.
     *
     * To override this link in a child theme, remove the filter and add your own
     * function tied to the get_the_excerpt filter hook.
     *
     * @since Twenty Ten 1.0
     * @return string Excerpt with a pretty "Continue Reading" link
     */
    function twentyten_custom_excerpt_more( $output ) {
    	if ( has_excerpt() && ! is_attachment() ) {
    		$output .= twentyten_continue_reading_link();
    	}
    	return $output;
    }
    add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );

    that should do??

    Thread Starter synchole

    (@synchole)

    Brilliant! Thank-you very much.

    I’m trying to do the same thing without modifying the original functions.php, since I’m using a child theme. I don’t want my changes to be erased the next time the WP team decides to update twentyten…

    Here’s the code I have in my child theme’s functions.php, and it doesn’t seem to be doing anything. Basically I want to remove the “Continue reading” link all together.

    remove_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );
    remove_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );
    
    function sbt_continue_reading_link() {
    	return '';
    }
    
    function sbt_auto_excerpt_more( $more ) {
    	return '' . sbt_continue_reading_link();
    }
    add_filter( 'excerpt_more', 'sbt_auto_excerpt_more' );
    
    function sbt_custom_excerpt_more( $output ) {
    	if ( has_excerpt() && ! is_attachment() ) {
    		$output .= sbt_continue_reading_link();
    	}
    	return $output;
    }
    add_filter( 'get_the_excerpt', 'sbt_custom_excerpt_more' );

    A friend helped me out… put this in functions.php of your Child Theme to remove “Continue Reading” altogether:

    function sbt_auto_excerpt_more( $more ) {
    return 'aaa';
    }
    add_filter( 'excerpt_more', 'sbt_auto_excerpt_more', 20 );
    
    function sbt_custom_excerpt_more( $output ) {return preg_replace('/<a[^>]+>Continue reading.*?<\/a>/i','',$output);
    }
    add_filter( 'get_the_excerpt', 'sbt_custom_excerpt_more', 20 );

    edit: maybe this doesn’t… worked then throwing 500

    function twentyten_custom_excerpt_more( $output ) {
    	if ( has_excerpt() ) {
    		$output .= '';
    	}
    	return $output;
    }
    add_filter( 'get_the_excerpt', 'twentyten_custom_excerpt_more' );

    Thank you Mike62! I’ve been stumped over this for hours and your solution worked like a charm for me. 🙂

    This also saved my skin mike62! You are awesome!!!

    mike62, very nice piece of code! But if i want at the same time to remove and other tags like <div..> <p> etc altogether as the <a…> , how will i add them to your code?

    Thank you.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Removing 'Continue Reading' from Excerpts’ is closed to new replies.