Modify the text of the “Read More” link in Genesis Framework – .com

In this tutorial we will see how to modify the text of the “Read More” or “Leer Más” link in a Genesis Framework child theme.

Add the “Read More” link to a post

In this case we are going to focus on Genesis, but these steps are similar if we use other templates.

Surely you have seen more than once in a WordPress blog the text “Read More”, “Continue reading”, “Read More” or similar. This tag can be added from the WordPress post editor, and it is used to display a summary or extract of an article, followed by the link to continue reading.

To add it to an entry, we will open it in edit mode, position the cursor behind the corresponding text, clicking, and click on “Insert the ‘Read more’ label”.

This label will have a specific text that we could modify in several ways, in this case we are going to see how to replace it in (more about this fantastic framework in ) using a small piece of PHP code. So, here we go!

Modifying the text of the “Read more” link in Genesis

Before we get to work with the code, let’s check that the field “Genesis/Theme Settings/Content Archives/Display” has the value ” selectedEntry content“, and that the character limit is disabled in “Limit content to”.

Once done, we can continue. The code that we are going to use this time is very simple, so it is not necessary to install any plugin with extra features. In fact, we can add this code snippet directly into a utilities plugin that we have previously created in WordPress, or if we use Code Snippets create a snippet.

See also  Design tips course #8. Stamps - .com

As we have commented on other occasions, the most widespread solution is to add it to the theme’s function.php file, but it is not the most appropriate in these cases because we can lose the changes when updating to a new version. We talked about it in the tutorial about .

Well then, let’s go add the code to our utilities plugin. Remember that first it is convenient to deactivate it from the WordPress desktop, “Plugins”, to avoid errors that may arise while we make the changes.

Once we have deactivated it, we will have to access the plugin through the file manager of the hosting where the web is hosted, or through an FTP program such as Filezilla.

This plugin will be in the directory inside the “/plugins/plugin_name” directory, inside the “wp-content” folder of our site. And now, finally with the code. It will be similar to the following:

add_filter( ‘the_content_more_link’, ‘bld_mod_read_more’ ); function bld_mod_read_more() { return ‘‘; }

Once we include the code in the plugin, usually towards the end, we simply have to save the changes and activate it again from the WordPress administration panel.

Also tell you that the expression that appears in bold corresponds to the text, the anchor text or anchor text, of the “Read more” link, that is, what we write there will be replaced by that text.

We can really do it however we want, so that we can modify the text as we please. Although we recommend replacing it with a text that is intuitive so that the readers of the site know that the link will take them to the rest of the article, which in the end is what interests us.

See also  Professions in WordPress - .com

Analyzing the code

The code, as you can see, has only four lines if we count the closing brace. It consists of two parts, on the one hand we have the filter“add_filter”, and on the other the custom function“bld_mod_read_more”.

Filters are similar to action hooks, but they are used to modify content before it is used, in this particular case, before it is displayed on the blog. If you want to know more about filter and action hooks, they are explained and seen in detail in the , specifically in the fourth lesson we see them and in the fifth the . If you work with the Genesis Framework, knowing these functions will be extremely useful when adding or changing functionality in a template.

Going back to the code, and specifically the filter, we see that what we are doing is associating the “bld_mod_read_more” function to the “the_content_more_link” hook, so that it is executed in it.

Next, we simply have to define the custom function “bld_mod_read_more”, which in this case returns the modified link with whatever text we want.

Finally, comment that this same code can be used for Genesis Framework child themes as well as for other themes. The following is an example of how it would look if we do it in the Twenty Seventeen template.

And that’s it! As you can see, customizing the anchor text of the “Read more” link is very easy and will take very little time.

Summary and conclusion

The “Read More” link allows us to display a summary or lead of a post on the blog page. We can easily add it from the entry editor, by clicking on the corresponding button. We will have to have the “Entry content” option checked in the Genesis Framework configuration as we explained in the tutorial.

See also  Convert a website from HTML to WordPress - .com

If we want to modify the text that appears in it using code, we must add a small snippet to WordPress.

And that’s all! If you want to learn more about Genesis, we recommend the , the and the . If you subscribe to , you will have access to the framework, these courses, and many others. There are more than 6047 videos that you can make immediately, we are waiting for you inside! 🙂

Loading Facebook Comments ...
Loading Disqus Comments ...