functions.php

Change more-link display text in WordPress

For a recent project we created an online house pricer for the Dutch market, Huizen Prijs Checker. The backend, a statistical model, was built using Java which connects to our PHP / WordPress frontend using an API. We have worked with WordPress before, but once again we were surprised to see how easy it’s to setup and customise using templates and plug-ins.

The site being local to Dutch market is all in Dutch. This meant creating pages and blogs in Dutch. Which works wonderfully. The one thing which gave us headache was the continue reading text displayed by the more-link object.  The tag is inserted using the WordPress editor as shown here:

read more insert

On your blog-role or category pages a link will be displayed with the text “Continue reading ->”, like so:continue

This wasn’t any good as our site was meant to be in Dutch. So we where hoping for something like:

lees meer

It took quite some time to figure out how to get our theme to display a “continue reading” link with custom text. As it turns out this can be fixed by creating a child package. Details on how to do this can be found in WordPress Codex. Once you have the child theme setup the link text can be modified by adding a new read_more_link function to the functions.php file in your theme. This function will then override the default behaviour of the links. The following snippet does the trick. Continue reading