text replace not working in footer

You can see in the text replace feature in the ulmitate branding is not working. Neither the text or hyperlink in the footer of the homepage is getting re-written. Please help, thanks!

  • Adam Czajczyk

    Hello Jonathan,

    I hope you're having a nice day and don't mind me jumping in :slight_smile:

    Since you are going to make similar change to other sites as well I think it'd be better if I explain how to make it instead of doing it for you.

    As my colleague Milan already mentioned, the string/phrase must be "translatable" in order to work with Ultimate Branding "Text Change" feature. Instead of being "hardcoded" then it should processed with one of following functions:

    1

    __();

    e.g

    $my_text = __('Some text','Divi');

    2

    _e ();

    e.g.

    _e('Some text','Divi');

    That first function returns the string instead of printing/echoing it to the screen and the second one echoes it to the screen (just like regular PHP "echo" function). The point is that both these functions first try to find that string in translation file. The "Divi" value in both cases is a text-domain name for your theme so if you are using Divi on all your pages you should stick to this, otherwise you will need to find out about theme's text-domain name.

    The "fix" here is to wrap those "hard coded" phrases in site footer if one of these functions, depending on the context. If particular string is inside other function, you'd want to use function #1, if it's just a "plain text" you'd need to use function #2.

    You can avoid overwriting these changes upon theme update. All you'd need to do is to create the simplest child theme of your site's current theme.

    That child theme should include tweaked "footer.php" file. Then you just need to switch the site from parent Divi theme to that child theme and this way:
    - fix would be applied
    - it should be immune to Divi updates.

    I hope that helps!

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Jonathan!

    As I explained, those not-translatable strings are "hard coded" in theme files. Therefore there's no other option to make them translatable/changeable than fixing the theme. This could be done in two ways:

    1. Editing theme files directly - this is not recommended because it can lead to unexpected results in case of any mistake and also the changes would be lost upon plugin's update

    2. Creating child-theme that would include an adjusted footer file

    You most likely though will not need to do this for all the sites. In case of Multisite:

    - you need to create only this single child theme
    - then just switch all the sites/sub-sites that are currently using Divi theme to that new child theme

    In case of multiple single/regular WP sites that all use Divi (the same release):
    - you need to create only this single child theme
    - then install this child-theme on each site and enable it

    There's less work involved that it may seem at first :slight_smile:

    Best regards,
    Adam

  • Dimitris

    Hey there Jonathan,

    hope you're having a beautiful day and don't mind chiming in! :slight_smile:

    doesn't your blog post I could do this via a plugin?
    https://premium.wpmudev.org/blog/theme-modification-plugin/
    Or am I missing something?

    As the blog post mentions, this is mainly to be used across different installations with different themes, that's why in the example are being used just some custom CSS and JS sections.
    Messing with templates of multiple themes can be tricky though, as you should be based in default action hooks like wp_footer().
    In your case this may be possible if this hard-coded string is part of an action that can be overridden, it will require some more coding most probably, but it won't have any difference to a child-theme like Adam proposed, apart from the ability to be used with other themes (with unpredictable results as you can imagine).

    Hope this helps,
    Dimitris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.