Is there any documentation that you are following?
Is there a similar example that we can see?Hello!
I would like to add a text and a button at the top of all my already published posts, and I would like that text to be translated and displayed in the appropriate language.
Is there a simple way to do this? I have the plugin "Quick Adsense ", which allows me to insert parts of a code/text in a simple way (for example to insert something at the beginning of the post, at the end of the post, etc). I have tried to put this embedded code in one of the sections of the plugin:
<font size="4" color="black">
Text testing:
<?php _e( 'test-string', 'my-domain' ); ?></font>
Then I scanned the theme and also the plugin from WPML but it doesn't show the string to translate.
What am I doing wrong, is there a faster way to do it?
Thank you for contacting WPML Support, I will gladly help you.
You would need to put the code of the string/s you need to place the code in your theme template file, the plugin "Quick Adsense" allows you to insert ads code which is called and loaded on the website after the page is loaded, which is different from the way how the WPML strings work.
Try adding your custom string code to the theme template file (generally single.php), after that scan the theme again for strings.
But once I put the code in the theme, how do I insert it into the Quick Adsense plugin?
Could you give me an example of how to add some text please?
What I should put in the theme and then how to reference it.
Please note we can not support or debug custom-coded solutions as per our policy, we will do our best to suggest a correct approach but if you need custom coding I suggest using WPML contractors' service: - https://wpml.org/contractors/
I hope the information provided was helpful and thank you for understanding.
Hello again! I have tried to add the string txt to the theme template and I can see now in WPML.
As I told you in my previous message, the thing I need to know is how to reference this text, so I can display it on my page (from Quick Adsense or any other place).
I have looked at the documentation but I have not seen clearly how to do it. I have seen the option to use the following:
As I mentioned in my previous reply, the plugin "Quick Adsense" is not for adding custom code/functions to the website through it, as mentioned on their official website: "Quick Adsense is an Ads management WordPress plugin."
Is not related to your case, that code is used if you are coding a custom plugin.
---
The code that should be added on your theme's file is:
<?php _e( 'test-string', 'my-domain' ); ?>
* The code should be placed exactly where you want the text to appear (ex: before the title, or before the content) directly on the file and not through the plugin "Quick Adsense".
After, scan your theme from WPML -> Theme and plugins localization, and after the scanning is finished, the string should appear on WPML -> String Translation, where you can then translate the string and it should appear translated on your website.
ohhh what a pity, the thing is, if I can't use "quick adsense" (which was just an example), is there any other plugin or tool that I can use in a simple way, to put a text like this at the beginning of every post, at the end of every post, etc?
Do you have any suggestion or recommendation for that need? I think it's something relatively simple so I imagine there will be simple options
So that it can be inserted without having to add it hardcoded into the wordpress theme, which is not something advisable in the long term (updates, etc).
Putting text at the beginning or the end of every post should be easily manageable using the code example directly in the theme file. I suggest you try using a child theme to prevent any overwrite from any update/upgrade of the theme to all the custom code you might use.
There should be different WordPress plugins that offer adding snippets of code and custom code to themes. Unfortunately, I don't have any recommendations/suggestions for any plugin or tool that might be able to achieve what you want.
Thank you for understanding and let me know if you have any other questions.
Kind regards,
Marsel
The topic ‘[Closed] Translate custom text on all the posts’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.