Forums

Show Excerpt and 'read more' instead of full post in Grassland Theme (2 posts)

  1. onelovelivity
    Member
    Posted 1 year ago #

    I want to only show the first few lines of a post with a 'read more' direct to the entire post. I searched the forum already and tried the advice there to change the indexphp from the_content() to the_excerpt() but this did not offer a link to the entire post and also did not give me the option to indicate how many lines I wanted to show. (I did this real easy on my other blog but maybe the function came with the theme)

    Thanks

  2. jkovis
    Member
    Posted 1 year ago #

    > this did not offer a link to the entire post
    Try this:

    <?php the_excerpt(); ?>
    <a href="<?php the_permalink(); ?>" title="permalink to <?php the_title(); ?>">Read More</a>

    > did not give me the option to indicate how many lines I wanted to show
    -- the excerpt defaults to show the first 55 characters of a post. To change that, add the following to your theme's functions.php file (100 is the new limit in this case):

    add_filter( 'excerpt_length', 'new_excerpt_length' );
    function new_excerpt_length( $length ) {
    	return 100;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic