How to Create a ‘Read More’ Button for Excerpts in Genesis

Requirements for user interface will depend on every individual and can be differed from person to person. With the vast diversity of user base that WordPress enjoys the user interface requirements also tend to deviate drastically. While there might be a certain user base that might like one aspect of UI the same doesn’t hold true for everyone. In such a scenario, WordPress theme developers are finding it increasingly difficult to accommodate all types of requirements.

In such a scenario people often need theme customizations and that is where developers like me come into the picture.

In today’s post, I am going to explain how to Create a ‘Read More’ Button for Excerpts in Genesis.

My code here is specific to the Genesis Framework. However, a similar logic can be applied on any WordPress theme or plugin.

1. Display Excerpt

By default, the short summary that is displayed on the blog page for every blog post is extracted from the blog post’s content. Which means a few words from the introduction of the post are taken and displayed as a summary.However, if what you need is to display some custom content as summary, often known as excerpt then the following tweak would be required.

However, if what you need is to display some custom content as summary, often known as excerpt then the following tweak would be required.

4. Append Ellipsis to Excerpts

The number of words or characters that can be displayed in an excerpt are limited. Due to this there is a possibility that the words or sentences might get cut midway rendering them incomprehensible to the reader. In order to avoid this, the ellipsis can be appended to all excerpts, manual as well as automatic.

To fulfill this requirement, the following code will have to be uncommented in the ‘custom_excerpt’ function.

//$text= substr_replace($text,"...",strpos($text, "</p>"),0);

5. Specify Length for Automatic Excerpts

The following code will allow you to define the maximum length of automatic excerpts.

With that piece of code, we are done with creating a ‘Read More’ button for all blog posts on the blog page. All the above code can be added to the functions.php file of the theme. An alternative method would be to to create a template and the code to the template.

So that was about how to create a ‘Read More’ button for excerpts in Genesis. Like I said earlier the same logic can be used for any other WordPress theme.

I hope this post was useful to you. Do let me know your thoughts on the post.