Header disappeared after editing a different header

Dear Themeco,

When I just edited my custom text in my header and saved it, my header suddenly completely disappears. This happened when I opened my secondary header to edit, so not just after saving.

Then my second header also disappeared (or made itself completely empty). In both headers all the bars, containers and content disappeared.

I think the problem can be found in an error in a wa.me link that I’ve put in the secondary header a couple of days ago.

Can you think of any solution to get my headers back? I have a temporary one now.

Best,

Sven

Hello @svenbiesterbos,

Thanks for writing in!

I have inspected your site and there is an error in your site.

1.) You inserted a PHP code in the JS custom section which is not correct:

add_filter('gettext', 'x_translate_text' , 20, 3);
function x_translate_text ( $translated_text, $text, $domain ) {

$translation = array (
'View Post' => 'Bekijk deze vacature'
);

if( isset( $translation[$text] ) ) {
return $translation[$text];
}

return $translated_text;

}

This code will only work if you place it in the child theme’s functions.php file. It is not advisable to insert this in the parent theme’s functions.php file because it will just be overwritten when there is a theme updated. Because what you are trying to accomplish requires a template customization, we would highly to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.

2.) Since you have installed a caching plugin WP Super Cache, please clear your plugin cache after site changes before testing your site. This can cause the changes to not take place on the front end. It will eventually show up when the cache regenerates, but it’s not ideal if you’re looking to see your changes immediately. Caching plugins are best to turn on only when you’ve finished building the site.

Hope this helps. Please let us know how it goes.

Thanks for responding so quick!

It’s still weird for me how that showed up there, because I can’t write or read PHP.
Can you tell me what this PHP is for?

I’ve deleted the code and deactivated the cache plugin but it isn’t showing any difference.

In the meanwhile I created the header again based on some screenshots I had, so it’s not that big of a problem anymore.

Hi @svenbiesterbos,

The PHP code is to translate the View Post text.

Please let us know if you have any question.

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