WordPress.org

Support

Support » Themes and Templates » [Resolved] Remove “Continue Reading” from TwentyTen

[Resolved] Remove “Continue Reading” from TwentyTen

  • I don’t use excerpts at all. With the default theme in WordPress pre-3.0, viewing posts from a search or from a category or from a month showed the full post for all posts displayed.

    The TwentyTen theme in WordPress 3.0 now shows only part of the post followed by “Continue Reading”. I’ve searched around and I cannot find a way to remove this. Do I need to start hacking away at .php files? I’d like to full post to be displayed.

Viewing 15 replies - 1 through 15 (of 16 total)
  • I thought Twenty Ten displayed the whole post on the main page and archive pages unless you use the <!--more-->.

    The category archives do use template tag, the_excerpt().

    The code is in loop.php.

    Whole posts appear on the main page.

    I don’t use the “more” construct or excerpts. Prior to 3.0, whole posts were displayed anywhere and everywhere. In 3.0, only partial posts are appearing if I select a particular month or category for example. I’d like the pre-3.0 functionality back, although I do understand this is theme-dependent. The 3.0 default theme should not have made such a dramatic change though, especially if it is not easy to revert to the pre-3.0 behaviour.

    How would I go about removing the “Continue reading” text which appears on all posts as mentioned above? I’m not keen on hacking chunks of code out of PHP files unless I know what I’m doing.

    You would use the_content instead of the_excerpt in loop.php.

    Replace this

    function twentyten_continue_reading_link() {
    	return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
    }

    with

    function twentyten_continue_reading_link() {
    	//return ' <a href="'. get_permalink() . '">' . __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) . '</a>';
    }

    in functions.php file

    @chinmoy – that won’t allow the “full post to be displayed”, will it?

    Twenty Ten uses the_content if you are not on a search or archive page, but otherwise shows the the_excerpt

    <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
    	<?php the_excerpt(); ?>
    <?php else : ?>
    	<?php the_content( __( 'Continue reading <span class="meta-
    <?php endif; ?>

    So you can just take out that the if statement if you always want to show everything.

    <div class="entry-content">
    	<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    	<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    </div><!-- .entry-content -->

    @spencerfinnell

    Thanks — your suggestion worked. Now when I look at posts from a month or a category or a search, the full post is displayed for all posts, which is exactly what I wanted. Even though I don’t use excerpts, it seems that WordPress creates them on the fly unless that code is removed.

    Can someone help me with finding the template to edit
    I want to remove the […] in the archive pages and use insert my own read more.
    http://www.kjagen.com/category/news/

    fkaf,

    If you want to remove the […], find this in your functions.php file

    function twentyten_auto_excerpt_more( $more ) {
    	return ' …' . twentyten_continue_reading_link();
    }
    add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );

    and replace with this

    function twentyten_auto_excerpt_more( $more ) {
    	//return ' …' . twentyten_continue_reading_link();
    	return '' . twentyten_continue_reading_link();
    }
    add_filter( 'excerpt_more', 'twentyten_auto_excerpt_more' );

    The // just comments out the elipses and the added line returns an empty string.

    Full details on modifying your excerpts are found here: http://codex.wordpress.org/Function_Reference/the_excerpt

    tradiart

    @tradiart

    Hello!

    Each time the TwentyTen template is updated, all modifications are gone.

    Can the twentyten_continue_reading_link function be modified in our own functions.php file?

    Thank you!!

    I was strugling with this, until I read the functions.php file on twentyten:
    “Functions that are not pluggable (not wrapped in function_exists()) are instead attached to a filter or action hook. The hook can be removed by using remove_action() or remove_filter() and you can attach your own function to the hook.
    We can remove the parent theme’s hook only after it is attached, which means we need to wait until setting up the child theme:
    ` add_action( ‘after_setup_theme’, ‘my_child_theme_setup’ );
    function my_child_theme_setup() {
    // We are providing our own filter for excerpt_length (or using the unfiltered value)
    remove_filter( ‘excerpt_length’, ‘twentyten_excerpt_length’ );

    }
    `

    It worked for me.

    Actually, in your functions.php file:

    ABOVE the function twentyten_auto_excerpt_more( $more ) {

    FIND this function:

    function twentyten_continue_reading_link() {
    return ‘ ‘ . __( ‘Continue reading <span class=”meta-nav”>→</span>’, ‘twentyten’ ) . ‘‘;
    }

    COMMENT OUT the return clause like this:

    function twentyten_continue_reading_link() {
    //return ‘ ‘ . __( ‘Continue reading <span class=”meta-nav”>→</span>’, ‘twentyten’ ) . ‘‘;
    }

    Now it won’t show the link!

    If I may point out…any edits to twentyten theme are not safe and will be lost…
    http://go.rvoodoo.com/WPchild

    I made a writeup about it after seeing so many people losing their edits on here

    Ah, right, I use a COPY of the twentyten theme folder. That way i can customize the website design and still retain any original code in case i have to fall back to something that broke.

    that’ll work, good job! Just wanted to make sure!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] Remove “Continue Reading” from TwentyTen’ is closed to new replies.