This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Tagged: Custom Work
This topic contains 5 replies, has 2 voices.
Last updated by Long Nguyen 1 year, 8 months ago.
Assisted by: Long Nguyen.
Author | Posts |
---|---|
September 12, 2023 at 3:05 pm #14384915 | |
eytanB |
I am trying to: show links in categories in the CPT blog Link to a page where the issue can be seen: hidden link I expected to see:all links to lead to english tax Instead, I got: At the bottom of this page there are links to other cateogries, some of them lead to different language like hidden link I already tried this Go to WPML > Support > Troubleshooting > Clean up and click to run next: POST - > Synchronize posts taxonomies This is the code that displays those categories <section class="block block-categories alignfull"> // Get the current language $terms = get_terms(array( foreach ($terms as $term) { echo '<div class="category">' . sprintf(esc_html__('%s', 'freightos'), $term_link) . '</div> '; |
September 15, 2023 at 3:01 am #14400191 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi Eytan, Thank you for contacting WPML support, I'd be happy to help you with this issue. You are using a custom code to display categories on your site, I would like to inform you that helping you with custom code, is out of the scope of WPML. But I can suggest you can check some points: - "lang" parameter: I don't see this parameter is supported by WordPress, I think this won't work properly. Refer to the WP documentation https://developer.wordpress.org/reference/functions/get_terms/ // Get the current language $current_language = apply_filters('wpml_current_language', null); foreach ( $terms as $term ) { $term_id = apply_filters( 'wpml_object_id', $term->term_id, 'mp-resource-category', false, $current_language ); // get other term info by ID } Refer to the documentation https://wpml.org/wpml-hook/wpml_object_id/ If you are not able to accomplish this, I would recommend you contact one of our certified partners who will be more than happy to help you with this. In this link, you will find a list of our certified partners: https://wpml.org/contractors/ Look forward to your reply. |
September 18, 2023 at 6:19 pm #14414835 | |
eytanB |
Hi, I tested what you wrot and still gets the wrong link URL, Here is my updated code $terms = get_terms(array( foreach ($terms as $term) { echo '<div class="category">' . sprintf(esc_html__('%s', 'freightos'), $term_link) . '</div> '; Can you have a look and help us fix this please, |
September 19, 2023 at 1:19 am #14415733 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, Please replicate the issue on a sandbox site, I will try to investigate the issue there. With this link, you can login directly to the admin area hidden link Note: please do not restore your site on the sandbox site. Look forward to your reply. |
September 25, 2023 at 9:27 pm #14462345 | |
eytanB |
Not sure what you mean, but my issue is realted to my current setup with CPT and taxonomies, I can't create it on the site you gave me, I can duplicate my site to a staging and give you FTP access if you want but this sandbox will not help in this case, please help! |
September 26, 2023 at 4:25 am #14462905 | |
Long Nguyen WPML Supporter since 02/2022
Languages: English (English ) Timezone: Asia/Ho_Chi_Minh (GMT+07:00) |
Hi, I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to have a testing site where the issue is replicated. Your next reply is set to private to share the info. And let me know where I can find the code on your site. ❌ IMPORTANT: Please backup your database and website before proceeding ❌ Look forward to your reply. |
September 26, 2023 at 3:30 pm #14468211 | |
eytanB |
The was resolved, not sure how but its fine now |