Replace text with JS

In one plugin I need to change text, they don’t have proper strings in order to just translate it. I can edit directly the PHP code, it works, but is very though and surely I will lose in a future upgrade.

That’s what I need, if I could do it via CSS editing would be very easy and safe from updates.

https://www.lumi**.online/wp-admin/admin.php?page=ihc_manage&tab=notifications

you can see the text: “Ultimate Membership Pro”, but can not change the text itself.

  • Adam Czajczyk
    • Support Gorilla

    Hello ccbbam

    I hope you’re well today and thank you for your question!

    I’ve modified the code that Luis tried during the chat slightly and it seems to be working fine now. When you login to FTP you will find a file called

    ultimate-membership-change-text-in-admin.php

    inside /wp-content/mu-plugins folder.

    You can edit that file and replace “I was replaced” text with your own text. There’s no need to do anything else after you adjust the text and save the file and your custom text should be applied.

    I hope that helps :slight_smile:

    Best regards,

    Adam

  • ccbbam
    • Flash Drive

    Great Adam, many thanks it is great!

    Please, could you guide me to use the same code to the associate plugin (Affiliate Pro)?

    Here is the page, you can see the correspondent title – Ultimate Affiliate Pro.

    …/wp-admin/admin.php?page=ultimate_affiliates_pro

    I can see the div, it is :

    div.uap-page-title

    I tried to copy your code into the same file, but… sorry broke the site. So if you can give one more great helping hand…

    Of course I just removed and left as you wrote!

    Thanks again!

  • Adam Czajczyk
    • Support Gorilla

    Hi ccbbam

    Copying entire code would indeed break the site. There are just to lines that need to be “cloned” and adjusted. These are the lines:

    var replaced = $('.iump-page-title').text().replace('Ultimate Membership Pro', 'LUMINA Membros');
    $('.iump-page-title').text(replaced);

    I’ve made the change in the file already so take a look there and I think you should get the idea how to add other text changes as well :slight_smile:

    Best regards,

    Adam

  • ccbbam
    • Flash Drive

    Hi Adam,

    Thanks for your explanation but I am afraid there is a special case I was not able to manage.

    There are 2 pieces of code. uap-dashboard-title and uap-page-title. For dashboard it worked, that was the one you installed. But not for pages.

    It is curious to note this seem to be an identical situation to first plugin, where you added the code to change page title on pages, not on dashboard (that I edited directly on file)

    When added, it returns to page all titles possible for that page, messing it.

    here is the dashboard

    /admin.php?page=ultimate_affiliates_pro

    and here is a sample page, you can see other pages selecting top menu

    /admin.php?page=ultimate_affiliates_pro&tab=ranks

    :wink:

  • Adam Czajczyk
    • Support Gorilla

    Hello ccbbam

    Thanks for the additional explanation.

    I checked the site and I could see the issue indeed when I tried to change .uap-page-title text. This happens because the UAP plugin is using the same class name in multiple places.

    In this particular case I was able to give a bit more specific selector in my code and it seems to be working fine now (see the code as well please).

    Can you confirm that?

    Best regards,

    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.