So, I’m using custom post types, all in PODS, and Polylang for translations. The thing is, when I try to translate one of the posts, all the content on the original post type is duplicated to the translated version.
For example, I have a field game title in the custom post type. The english version is “Great game”, then I translate it with the + of polylang, and add Buen juego for the spanish language. When I check back the english version, the english text changed back to Buen juego instead of remaining the original text.
I have solved it in:
Languages > Settings > Synchronization > Disable custom fields check
Answering my own question since the only help I found was on Slack support channel which won't be documented for posterity.
Basically Polylang has a Synchronisation setting, when it's turned on it synchronises the meta data of posts, but since PODS uses that data for the actual PODS system, Polylang will synchronize all the translations constantly.
Just disable that option if you're having this problem :)
All Pods fields (and most field UI plugins) store the data in the meta table. So if you set them to synchronize it will constantly overwrite each other.
There is no option (yet) to select which metafields to sync in Polylang
Related
I am a complete newb to wordpress. I am trying to help a friend out. She asked me to help her move her wordpress instance to another hosting provider.
I have done that for the most part. My issue is the original provider implemented a not-so-obvious way of an isotope filter on some UI elements.
Specifically the object is a company. Each company has a logo, the name of the company, a short description and a contact name / email.
These companies service states / areas and the idea behind the page is to select the state and only the companies for that state are visible.
From the brief searching I have done - there seems to be an overwhelming amount of plugins to support this.
I have tried creating a simple post with a featured image and adding in the text in the excerpt.
My problem is the links. I don't want the links to go back to the post - rather I want the links to go to a custom URL.
Is there a plugin that will allow me to define a custom post type (to include categories) and then filter on it similar to Isotope type of filtering?
There are many free plugins but if you are using the Elementor page builder. I am not advertising my product but as I saw your requirement matches a plugin that I am selling in the market.
The frontend filtering feature is not yet available to the released version but will be released soon. It basically allows you to build a custom grid as you like.
Is it something similar?
https://demo.geekygreenowl.com/elementor-387/
You have to create a custom post, there should be a custom field(custom URL) as well.
Or, You may create a WordPress query. https://developer.wordpress.org/reference/classes/wp_query/
also, coding will be required for filtering
I am using custom fields (with the free version of ACF) to add additional, sometimes required, formatted content to the respective custom post type entries. I put together a little site-specific plugin which includes filters to add the custom fields to excerpt and content and puts them out, via a loop, as a list of:
{CUSTOM FIELD LABEL}: {CUSTOM FIELD VALUE}
The website should be available in English and German. Using the Sublanguage plugin, I could translate most of the website, but not the custom field labels.
From what I read on i18n/l10n and Wordpress, I understood that I should best use __() for the labels when creating the custom fields. Since custom field creation is realized by ACF plugin code, I assume I have to create the fields "myself" so that I can do multilingual labels using __(). I guess, I would then realize the actual translation of the fields with Loco Translate.
ACF offers a neat way to export my already existing ACF-created field groups, which provides me with the PHP code to create the fields "on my own". I put the ACF code inside a new function in my site-specific plugin and hooked it to the acf/init action. I did pretty much the same as described in this question, but nothing happens: When I trash the custom field groups within the ACF interface afterwards, no custom fields appear in the "new post" screen.
So basically, I am having one question that, depending on the answer, will spawn follow-up questions:
Is this how I should and can realize bi/multilingual custom field labels?
If no: How else would you implement bilingual custom field labels/names?
If yes: Am I hooking the function to the wrong action?
PS: I wasn't sure if this belongs here or in the WP StackExchange, since part of it is coding related and part of translation-logic-related. Please tell me if I should move it over to the other platform.
Alright,
I was able to solve most of this myself in the meantime:
I did not hook into the correct action. As it turns out, acf/init is only available in ACFv5 (pro), while the free edition is still in version 4.x. I hooked into init - et voilà: there are my field groups.
Using __() functions to declare my custom fields' labels, Loco Translate made it quite easy to translate the strings myself.
Conclusion
Apparently, my assumptions were correct - this is how to create internationalized custom field labels :) Nevertheless, I wasn't able to effectively translate the options of a checkbox field I am using, although Loco recognized the string and I provided a translation.
However....
The solution is far from perfect:
I am now using two plugins to translate as much as possible on the website.
Creating the ACF field groups "myself" through PHP code in my site-specific plugin, I needed to remove them from the admin UI. This means, that it's going to be difficult for any standard users to change anything about them in the future (which might of course be a feature as well :))
I've create some custom posts on my customized theme in wordpress, in which the polylang plugin is activated.
The translation works well, but the problem is that I need that specified contents remain the same between translated posts. With the normal posts you can deactivate the translation for the media type, but this will not apply for custom content type.
For example, if I got two languages, like English and Spanish, and I create a new custom english post:
[ENG POST]
TITLE
content1 *
content2
media1 *
media2
I'd want that on the spanish post some of the contents to be already populated with some of the contents that I've already written\uploaded in the english post (the ones with the "*" ), like:
[SP POST]
-empty-
content1
-empty-
media1
-empty-
For the custom posts I'm using the CMB2 plugin.
Is there an elegant way to do this?
Never done anything like that, but to my knowledge polylang creates another post and, when loading the new language form, completely reloads CMB2 fields, triggering all related events.
Getting in the right event and finding the original post id should allow you to set the previous values as default for the corresponding fields, but it's just theory, since I never really tried. Let me know if it works.
If you use CMB2's custom fields to create those parts of the custom post type content, here is the more or less elegant, straightforward way to achieve the goal.
Create the wpml-config.xml file (it's pretty self-explanatory)
<wpml-config>
<custom-fields>
<custom-field action="copy">cf_content_to_populate</custom-field>
<custom-field action="copy">cf_media_to_populate</custom-field>
<custom-field action="translate">cf_content_to_translate</custom-field>
<custom-field action="translate">cf_media_to_translate</custom-field>
</custom-fields>
</wpml-config>
and save it to the root directory of the theme you use.
cf_content_to_populate and cf_media_to_populate will be available all over the languages without translation, but cf_content_to_translate and cf_media_to_translate will require translation.
Using wpml-config.xml you can manage copying and/or translation of
specified custom fields;
specified custom post types;
specified taxonomies;
specified admin texts as custom plugin or custom theme options etc..
But you can't do this on per-post basis out-of-the-box.
Official Polylang documentation on The wpml-config.xml file.
I was recently implementing a custom post type in WordPress, and added WPML so I could translate it's title & content.
This post type (city) also has some custom metaboxes (metabox.io) like:
Coordinates
isFeatured
Address
etc...
The problem I'm facing now is these custom fields get stored against the post ID, and need to be added for each language (different languages are different post ID's). This is neither convenient or practical, given that I must now duplicate all the values from these fields in each language, and if there's a mistake one same city may have different coordinates in different languages.
My question is, what would be the best way to tackle this problem? How can I have one set of metadata relate to all the translations of a same post?
This way I only need to add it once for each city, and edit it in one place if needed.
Thanks,
I have a WordPress blog and I am using the Automatic Youtube Video Posts plugin.
However, my site is in Danish and I would like for my posts to be in Danish.
Is there a way or a plugin that automatically translates the actual content of wordpress posts when they're posted?
Not just by using a real-time-translate-button, but actually changes the post data to the new language (So that it is read as Danish by google)
http://wordpress.org/extend/plugins/speaklike-worldwide-lexicon-translator/
http://wordpress.org/extend/plugins/bens-translator/
http://wordpress.org/extend/plugins/global-translator/
Those three examples are "automatic" translators, and work on posts . they also have a caching system for google.
However, since you "auto-post" - you might need to hook to them somehow. I never really used any, but I think that at least two of those are fully automatic and create the chosen translation on publish-time of post (and not real-time).
That being said - relaying solely on google translate service (or any other automatic service) for translation will likely to produce unwanted results.