Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 12:00 – 14:00 -
- 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 17:00 – 21:00 -

Supporter timezone: Europe/Vienna (GMT+02:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Bigul 3 weeks, 1 day ago.

Assisted by: Bigul.

Author Posts
August 29, 2024 at 12:26 pm #16119878

louiseD-7

Background of the issue:
I want to report two issues. First, I am trying to set an Archive Page where all sold products are displayed (hidden link and hidden link). I use a shortcode.

Here is the shortcode: function afficher_produits_stock_zero() { $args = array( 'post_type' => 'product', 'posts_per_page' => -1, 'meta_query' => array( array( 'key' => '_stock', 'value' => '0', 'compare' => '=' ) ) ); $query = new WP_Query($args); $output = ''; if ($query->have_posts()) { $output .= '

'; while ($query->have_posts()) : $query->the_post(); global $product; $output .= '

'; $output .= ''; $output .= str_replace('<img ', 'get_image()); $output .= ''; $output .= '

' . get_the_title() . '

'; $output .= '

'; endwhile; $output .= '

'; } else { $output .= '

Aucun produit en rupture de stock.

'; } wp_reset_postdata(); return $output; } add_shortcode('produits_stock_zero', 'afficher_produits_stock_zero');

Symptoms:
The English page displays only the products that were sold (stock:0) in English, and the French version displays only the products sold in French. Additionally, when I deactivate WPML, the website doesn't show anything except the landing page.

Questions:
How can I display all sold products in both languages on the Archive Page (archive is not the shop)?
Why does the website only show the landing page when WPML is deactivated?

August 29, 2024 at 5:32 pm #16121583

Bigul
Supporter

Languages: English (English )

Timezone: Europe/Vienna (GMT+02:00)

Hello,

Welcome to the WPML support forum. I will do my best to help you to resolve the issue.

You can list posts in both languages by adding the suppress_filters => true parameter in the query. Setting the "suppress_filters" query variable will help your theme display results from all languages. Please refer to the following tickets for more details.

https://wpml.org/forums/topic/search-results-from-other-languages-not-displaying/#post-8674273

https://wpml.org/forums/topic/how-to-make-wordpress-search-posts-and-pages-in-all-language/#post-13901871

When WPML is deactivated, all translated posts and pages are considered as part of the default language and will be listed normally. So could you please share a couple of screenshots or a screencast to better understand the following?

Why does the website only show the landing page when WPML is deactivated?

--
Thanks!

Bigul

The topic ‘[Closed] Issues with products display’ is closed to new replies.