Forum Replies Created
-
AuthorPosts
-
Arno
ParticipantHi Long,
Thanks, I will e-mail you.
By the way, in my last post I meant to write "Even for English, this does NOT return a value".
Arno
ParticipantFollow up: I've done a few additional tests.
The normal way to display a setting in a view works fine in English but not in German (no value is displayed):
{% set group = attribute( site, 'site-configuration' ) %} {{ group.site_settings_texts_more_itineraries }}I can see that the text value of the 'site_settings_texts_more_itineraries' field is stored in the database table wp_options, in the record with option_name = 'site-configuration'. So, I tried to get the value through the WordPress get_option function (https://developer.wordpress.org/reference/functions/get_option/):
{% set atext = mb.get_option('site_settings_texts_more_itineraries') %} {{atext}}Even for English, this does return a value. I would expect a standard function to access this data to work.
So far, I could only fine one work around: using WPML, I can duplicate the view for German, give it a slug with the "-de" suffix, and then use a hardcoded string instead of the setting value.
Do you have any suggestions, or would you like to take a look into a copy of the website?
Thanks!
Arno
ParticipantHi Long,
Thanks, good to see that this should work. You only have one view, right? It's not duplicated for each language?
Is there any other setting I need to check? Somehow I don't get the value in the secondary language, only in the default language.
Arno
ParticipantIt looks like it worked. Thanks!
Arno
ParticipantThank you. Ok, so you suggest to create a new taxonomy, then switch from the old to the new taxonomy, and finally delete the old taxonomy.
Arno
ParticipantMuch appreciated, thank you. Will try it out later.
August 25, 2022 at 12:33 AM in reply to: ✅Using rwmb_get_value on a multilingual website (WPML) #38028Arno
ParticipantHi Long,
Great, rwmb_meta works for me. I can pass the original post ID, so I don't need to request the translated post ID first. That's one less line of code 🙂 I'm not sure why rwmb_get_value() only works for English in my case.
Thanks!
Arno
ParticipantI can't find a way to solve this in Twig. The merge filter does not seem to work for this scenario. It looks like there are/were Twig "add" and "push" filters too, but they're not recognized in the view code.
For others with this issue: I created a PHP function to compose the tax query. As arguments, it takes the relation (AND/OR), an array of taxonomy slugs, and an array containing an array of terms.
function get_tax_query($relation, $taxonomy_slugs = array(), $term_ids = array()) { $tax_query = array(); if (count($taxonomy_slugs) > 1) { $tax_query['relation'] = $relation; } foreach ($taxonomy_slugs as $key => $taxonomy_slug) { array_push($tax_query, array('taxonomy' => $taxonomy_slug, 'terms' => $term_ids[$key] )); } return $tax_query; }So far this seems to work well.
If you know a way to do this directly in Twig, please share.
Arno
ParticipantI think what goes wrong with the Twig merge, is that it looks at the key-value pairs and overwrites the values already in the array. If this is in the array:
taxonomy: "travel-tickets"
and I want to add this:
taxonomy: "activities"
it will actually replace it. I think.Arno
ParticipantHi Long,
Thank you. Yes, your first example works. This is what I have and it works fine:
{% set args = { post_type: 'promotion', numberposts: 3, orderby: 'meta_value_num', meta_key: 'content_popularity', order: 'DESC', meta_query: [{ key: 'promotion_start_date', value: 'now'|date("Y-m-d H:i"), compare: '<=', }, { key: 'promotion_end_date', value: 'now'|date("Y-m-d H:i"), compare: '>=', }], tax_query: { "relation": "OR", 0: { taxonomy: "travel-tickets", terms: "336" }, 1: { taxonomy: "activities", terms: "324" } }However, whatever I try, creating the tax_query dynamically with "merge" fails (no results). And I don't understand the "do" example in your second link, to be honest.
Arno
ParticipantThat fixes the problem, thank you Long!
Arno
ParticipantHi Long,
Sure:
https://pasteboard.co/HpFSq20HYOfB.jpg
https://pasteboard.co/vlOG4ALyKpSX.jpgI can't show everything on a public forum, but this should be sufficient I think.
The problem is that it does not show the field values.
Arno
ParticipantI'd a appreciate an update from Meta Box staff about this.
Also, an overview of what can and can't be done with WP All Import would be very welcome. I assume that simple custom fields (text, numbers) and taxonomies won't be a problem as they are native WordPress?
Arno
ParticipantHi Long,
Ok, I understand. I found that ACF supports this for WPML. So, I think it's important for Meta Box to make sure that full compatibility is available soon. Personally I don't think it's new feature, but rather something that's missing despite the claimed compatibility with WPML.
Hopefully you'll be able to make this happen soon. Thanks a lot!
Arno
ParticipantHi Long,
Thanks a lot, that worked fine.
-
AuthorPosts