WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Remove "Continue Reading" from TwentyTen (17 posts)

  1. SabreWolfy
    Member
    Posted 3 years ago #

    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.

  2. MichaelH
    Member
    Posted 3 years ago #

    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.

  3. SabreWolfy
    Member
    Posted 3 years ago #

    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.

  4. MichaelH
    Member
    Posted 3 years ago #

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

  5. chinmoy
    Member
    Posted 3 years ago #

    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

  6. MichaelH
    Member
    Posted 3 years ago #

    @chinmoy - that won't allow the "full post to be displayed", will it?

  7. Spencer Finnell
    Member
    Posted 3 years ago #

    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 -->
  8. SabreWolfy
    Member
    Posted 3 years ago #

    @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.

  9. fkaf
    Member
    Posted 3 years ago #

    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/

  10. CafeTica
    Member
    Posted 3 years ago #

    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

  11. tradiart
    Member
    Posted 3 years ago #

    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!!

  12. lordarkad
    Member
    Posted 3 years ago #

    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.

  13. somethumb
    Member
    Posted 3 years ago #

    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!

  14. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    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

  15. somethumb
    Member
    Posted 3 years ago #

    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.

  16. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

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

  17. leewutzke
    Member
    Posted 2 years ago #

    How To Remove Continue Reading from posts on 2010 Theme:

    Here you can see that I changed Excerpt in the 2010 Theme Function PHP from 40 to 900. That removed the Continue Reading Link because I don't have any posts over 900 words. Change this to 1000, 3000, 4000 or what ever you need. Use whatever value you need to show the whole post instead of just part of the post. When you do this the Continue Reading Link is not displayed because the whole post is displayed. I recommend doing it this way because you are only changing the value for a function your are not changing the code. Nothing can break if you do it this way:

    function twentyten_excerpt_length( $length ) {
    return 900;
    }
    add_filter( 'excerpt_length', 'twentyten_excerpt_length' );
    
    /**
    * Returns a "Continue Reading" link for excerpts

Topic Closed

This topic has been closed to new replies.

About this Topic