Add HTML format to loco translate

Hello,

I saw this post to use a plugin to customize the nothing found page.

I am using Loco Translate to customize the static text on this page. It would be great to add simple HTML to the Loco translation, such as bold, paragraphs, and bullet points. A link would be nice too, but not necessary.

I was reading up on escaped text in the Loco Translate faqs and WordPress documentation.

How can I enable HTML formatting on the nothing found page without installing another plugin? Is there a specific string I can filter the text to allow these HTML tags while escaping anything else?

Hi,

Usually, Loco Translate does not allow adding HTML and cuts it out when it is displayed on the page because of security reasons (for example, if you need to outsource the translation to a third party and do not want to have the code injection). As a workaround, we recommend overwriting the 404 page through the template part and child theme using this documentation:

​I hope this is helpful to you

Thanks andrii!

1 Like

Hello Ken,

To customize the 404 page, all you got to do is duplicate the index.php from your theme and rename it to 404.php.

If you use a child theme, copy it in your child theme instead, then the sky is the limit : edit it to your like.

Cheers.

Hey Oliver,

Thanks, I copied index.php over to my child theme and renamed it to 404.php.

I made some changes to the text, however, it still shows the original “nothing found” message.

I’ll play around with it more.

Thanks!

OK, as it turns out…the 404 is working properly. If I type an erroneous URL, I see my custom 404 error message. Thanks again, @condorito.fr !

I also want to change the “nothing found” message that appears for no search result matches or a vendor profile page that has no listings. @andrii, I tried to follow the two how to’s you provided. I could not find the template part in the ListingHive theme to overwrite for this. Can you point me in the right direction please?

Hi,

Please note that this is already a specific 404, and you need to overwrite this template part using a child theme: How to override template parts - HivePress Help Center. That is, you need to copy this template part hivepress/templates/page/no-results-message.php at master · hivepress/hivepress · GitHub to child-theme-folder/hivepress/page, but note that this template part is the same and is used for listing search results as well (but, for example, you can add inside the condition, if it is a vendor page, then show a different message, if it is a listing, then the old one).

​I hope this is helpful to you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.