[resolved] Exerpts Read More Button (5 posts)

  1. faizanasad1
    Posted 11 months ago #

    Hello there i am using Hemingway wordpress theme and and i read your post in which you have written the code to make Posts exerpts on homepage and it worked for me but can i add a read more button and featured thumbnail to the excerpts...

  2. kevinleeme
    Posted 9 months ago #

    Hey Anders, just bumping this thread, is there code alongside the content.PHP that could help add a "Read More" link to the end of each excerpt?

  3. Anders Noren
    Theme Author

    Posted 9 months ago #

    Hi Kevin,

    Yes, it is possible, but you would have to use a child theme for the changes to remain when Hemingway is updated. You can read more about how to create a child theme here: http://codex.wordpress.org/Child_Themes

    When you've created a child theme, add a file called functions.php in the child theme folder. Open that file and add the following code:

    // Replaces the excerpt "more" text by a link
    function new_excerpt_more($more) {
           global $post;
    	return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read the full article...</a>';
    add_filter('excerpt_more', 'new_excerpt_more');

    Replace "Read the full article..." with the text you wish to use in the link. Save the file and activate the child theme in the WordPress appearance settings, and the link will be displayed after the excerpt.

  4. kevinleeme
    Posted 9 months ago #

    Anders, thanks for the info; quick question though, I noticed on my site http://www.productmanagerhq.com when I made a really long post, it actually automatically cut off at a certain point and added a button that says "Continue Reading."

    This seems to indicate to me that there's some script saying to automatically break off at a certain word count; can I simply just change the minimum word count requirement somewhere so that it automatically snips off each article on the home page and adds the continue reading button?

  5. Anders Noren
    Theme Author

    Posted 9 months ago #

    Hi Kevin,

    There isn't a built-in function for automatic excerpts in Hemingway – the Continue Reading button is displayed either when an excerpt has been added manually (through the excerpt field) or a <!--more--> link has been entered in the post content. I don't think there's a built-in limit in WordPress for how long posts can be on index pages either.

    - Anders


You must log in to post.

About this Theme

About this Topic