'Prêt à l\'expédition',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop('Prêt à l\'expédition (%s)', 'Prêt à l\'expédition (%s)')
));
register_post_status('wc-gcbd-ache', array(
'label' => 'Acheminement en cours',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop('Acheminement en cours (%s)', 'Acheminement en cours (%s)')
));
register_post_status('wc-gcbd-depo', array(
'label' => 'Au dépôt',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop('Au dépôt (%s)', 'Au dépôt (%s)')
));
register_post_status('wc-gcbd-livr', array(
'label' => 'En livraison',
'public' => true,
'exclude_from_search' => false,
'show_in_admin_all_list' => true,
'show_in_admin_status_list' => true,
'label_count' => _n_noop('En livraison (%s)', 'En livraison (%s)')
));
}
add_action('init', 'register_woocommerce_status');
// Add to list of WC Order statuses
function add_awaiting_shipment_to_order_statuses($order_statuses)
{
$new_order_statuses = array();
// add new order status after processing
foreach ($order_statuses as $key => $status) {
$new_order_statuses[$key] = $status;
if ('wc-processing' === $key) {
$new_order_statuses['wc-gcbd-expe'] = 'Prêt à l\'expédition';
$new_order_statuses['wc-gcbd-ache'] = 'Acheminement en cours';
$new_order_statuses['wc-gcbd-depo'] = 'Au dépôt';
$new_order_statuses['wc-gcbd-livr'] = 'En livraison';
}
}
return $new_order_statuses;
}
add_filter('wc_order_statuses', 'add_awaiting_shipment_to_order_statuses');
//https://stackoverflow.com/questions/50549062/rename-multiple-order-statuses-in-woocommerce/50550058#50550058
// RENAME COMMANDE ORDER
add_filter('wc_order_statuses', 'rename_order_statuses', 20, 1);
function rename_order_statuses($order_statuses)
{
$order_statuses['wc-completed'] = _x('Commande livrée', 'Commande livrée', 'woocommerce');
return $order_statuses;
}
// RENAME COMMANDE ORDER LIST
add_filter('bulk_actions-edit-shop_order', 'custom_dropdown_bulk_actions_shop_order', 20, 1);
function custom_dropdown_bulk_actions_shop_order($actions)
{
$actions['mark_completed'] = __('Marquer commande livrée', 'woocommerce');
$actions['mark_gcbd-expe'] = __('Marquer prêt à l\'expédition', 'woocommerce');
$actions['mark_gcbd-ache'] = __('Marquer acheminement en cours', 'woocommerce');
$actions['mark_gcbd-depo'] = __('Marquer au dépôt', 'woocommerce');
$actions['mark_gcbd-livr'] = __('Marquer en livraison', 'woocommerce');
return $actions;
}
// RENAME COMMANDE ORDER MENU HAUT
foreach (array('post', 'shop_order') as $hook)
add_filter("views_edit-$hook", 'shop_order_modified_views');
function shop_order_modified_views($views)
{
if (isset($views['wc-completed']))
$views['wc-completed'] = str_replace('Terminées', __('Commandes livrées', 'woocommerce'), $views['wc-completed']);
return $views;
}
// SCRIPTS FOOTER
function footer_scripts()
{
// AD360 HOMEPAGE
if (is_front_page()) {
$ad360_scripts = '!function(e,t,n,i,p,s,a,c,o){e[p]||((a=e[p]=function(){a.process?a.process.apply(a,arguments):a.queue.push(arguments)}).queue=[],a.t=1*new Date,(c=t.createElement(n)).async=1,c.src="//cdn.ad360.media/js/ad360pixelevent.min.js?t="+864e5*Math.ceil(new Date/864e5),(o=t.getElementsByTagName(n)[0]).parentNode.insertBefore(c,o))}(window,document,"script",0,"ad360"),
ad360("init","4ac64a2c-034e-4a00-8412-8a28b30b5bfc"),ad360("event","935e28a2-d831-481e-b131-860659bd6ba5", {someData: 1, otherData: "Commande"});';
wp_register_script('ad360home', '');
wp_enqueue_script('ad360home');
wp_add_inline_script('ad360home', $ad360_scripts);
}
// AD360 VISIT CATEGORY : Nos Packs (ID = 173)
if (is_product_category(173)) {
$packs_page_scripts = '!function(e,t,n,i,p,s,a,c,o){e[p]||((a=e[p]=function(){a.process?a.process.apply(a,arguments):a.queue.push(arguments)}).queue=[],a.t=1*new Date,(c=t.createElement(n)).async=1,c.src="//cdn.ad360.media/js/ad360pixelevent.min.js?t="+864e5*Math.ceil(new Date/864e5),(o=t.getElementsByTagName(n)[0]).parentNode.insertBefore(c,o))}(window,document,"script",0,"ad360"),
ad360("init","4ac64a2c-034e-4a00-8412-8a28b30b5bfc"),ad360("event","50cc62af-ea73-4776-9e27-7217ea55d219", {someData: 1, otherData: "cool"});';
wp_register_script('ad360packs', '');
wp_enqueue_script('ad360packs');
wp_add_inline_script('ad360packs', $packs_page_scripts);
}
// AD360 VISIT CATEGORY : Flash deal (ID = 319)
if (is_product_category(319)) {
$flashdeal_page_scripts = '!function(e,t,n,i,p,s,a,c,o){e[p]||((a=e[p]=function(){a.process?a.process.apply(a,arguments):a.queue.push(arguments)}).queue=[],a.t=1*new Date,(c=t.createElement(n)).async=1,c.src="//cdn.ad360.media/js/ad360pixelevent.min.js?t="+864e5*Math.ceil(new Date/864e5),(o=t.getElementsByTagName(n)[0]).parentNode.insertBefore(c,o))}(window,document,"script",0,"ad360"),
ad360("init","4ac64a2c-034e-4a00-8412-8a28b30b5bfc"),ad360("event","0e51547b-a019-4fb8-9a1f-b08eed976879", {someData: 1, otherData: "cool"});';
wp_register_script('ad360flashdeal', '');
wp_enqueue_script('ad360flashdeal');
wp_add_inline_script('ad360flashdeal', $flashdeal_page_scripts);
}
// AD360 TRACKING ADD TO CART -> FLASH DEAL/PACKS/OTHER
if (is_product()) {
$text = '';
if (has_term('flash-deals', 'product_cat')) {
// TRACKING FLASH DEALS
$text = '!function(e,t,n,i,p,s,a,c,o){e[p]||((a=e[p]=function(){a.process?a.process.apply(a,arguments):a.queue.push(arguments)}).queue=[],a.t=1*new Date,(c=t.createElement(n)).async=1,c.src="//cdn.ad360.media/js/ad360pixelevent.min.js?t="+864e5*Math.ceil(new Date/864e5),(o=t.getElementsByTagName(n)[0]).parentNode.insertBefore(c,o))}(window,document,"script",0,"ad360"),ad360("init","4ac64a2c-034e-4a00-8412-8a28b30b5bfc"),ad360("event","8c6e63a3-1c38-4720-927f-b7cd44652652", {someData: 1, otherData: "cool"});';
} else if (has_term('les-packs', 'product_cat')) {
// TRACKING PACKS
$text = '!function(e,t,n,i,p,s,a,c,o){e[p]||((a=e[p]=function(){a.process?a.process.apply(a,arguments):a.queue.push(arguments)}).queue=[],a.t=1*new Date,(c=t.createElement(n)).async=1,c.src="//cdn.ad360.media/js/ad360pixelevent.min.js?t="+864e5*Math.ceil(new Date/864e5),(o=t.getElementsByTagName(n)[0]).parentNode.insertBefore(c,o))}(window,document,"script",0,"ad360"),
ad360("init","4ac64a2c-034e-4a00-8412-8a28b30b5bfc"),ad360("event","9a1705d4-77ff-43f2-a266-860d32eb6315", {someData: 1, otherData: "cool"});';
} else {
// TRACKING OTHER
$text = '!function(e,t,n,i,p,s,a,c,o){e[p]||((a=e[p]=function(){a.process?a.process.apply(a,arguments):a.queue.push(arguments)}).queue=[],a.t=1*new Date,(c=t.createElement(n)).async=1,c.src="//cdn.ad360.media/js/ad360pixelevent.min.js?t="+864e5*Math.ceil(new Date/864e5),(o=t.getElementsByTagName(n)[0]).parentNode.insertBefore(c,o))}(window,document,"script",0,"ad360"),
ad360("init","4ac64a2c-034e-4a00-8412-8a28b30b5bfc"),ad360("event","7378f676-9ac5-4e9b-8e29-7a78c8185c23", {someData: 1, otherData: "cool"});';
}
$track_add_to_cart = '
var elem = document.getElementsByClassName("single_add_to_cart_button");
elem[0].addEventListener("click", function(e) {
e.preventDefault();
var script = document.createElement("script");
script.setAttribute("id", "trackcart");
script.type = "text/javascript";
script.text = ' . $text . ';
document.body.appendChild(script);
})';
wp_register_script('ad360trackcart', '');
wp_enqueue_script('ad360trackcart');
wp_add_inline_script('ad360trackcart', $track_add_to_cart);
}
// ACTIVE COMPAIGN TAG
$active_compaign = '(function(e,t,o,n,p,r,i){e.visitorGlobalObjectAlias=n;e[e.visitorGlobalObjectAlias]=e[e.visitorGlobalObjectAlias]||function(){(e[e.visitorGlobalObjectAlias].q=e[e.visitorGlobalObjectAlias].q||[]).push(arguments)};e[e.visitorGlobalObjectAlias].l=(new Date).getTime();r=t.createElement("script");r.src=o;r.async=true;i=t.getElementsByTagName("script")[0];i.parentNode.insertBefore(r,i)})(window,document,"https://diffuser-cdn.app-us1.com/diffuser/diffuser.js","vgo");vgo(\'setAccount\', \'67174622\');vgo(\'setTrackByDefault\', true);vgo(\'process\');';
wp_register_script('active_compaign_tag', '');
wp_enqueue_script('active_compaign_tag');
wp_add_inline_script('active_compaign_tag', $active_compaign);
}
add_action('wp_footer', 'footer_scripts');
// SCRIPTS THANK YOU PAGE
function thank_you_page_scripts($order_id)
{
// AD360 FOOTER OTHER TECHNIQUE
$order = wc_get_order($order_id);
$total = $order->get_subtotal();
$num_order = $order->get_order_number();
$other = '';
$ad360_scripts = '!function(e,t,n,i,p,s,a,c,o){e[p]||((a=e[p]=function(){a.process?a.process.apply(a,arguments):a.queue.push(arguments)}).queue=[],a.t=1*new Date,(c=t.createElement(n)).async=1,c.src="//cdn.ad360.media/js/ad360pixelevent.min.js?t="+864e5*Math.ceil(new Date/864e5),(o=t.getElementsByTagName(n)[0]).parentNode.insertBefore(c,o))}(window,document,"script",0,"ad360"),
ad360("init","4ac64a2c-034e-4a00-8412-8a28b30b5bfc"),ad360("event","4a5ab19a-00ce-4d7e-872b-7cf8bfbb840b", {someData: 1, otherData: "' . json_encode($order_id) . '"});';
wp_register_script('ad360thywo', '');
wp_enqueue_script('ad360thywo');
wp_add_inline_script('ad360thywo', $ad360_scripts);
}
add_action("woocommerce_thankyou", "thank_you_page_scripts", 20);
// VICTIME DE SON SUCCES
add_filter('woocommerce_product_add_to_cart_text', 'bbloomer_archive_custom_cart_button_text');
function is_variable_product_out_of_stock($product)
{
$variation_ids = $product->get_visible_children();
foreach ($variation_ids as $variation_id) {
$variation = wc_get_product($variation_id);
if ($variation->is_in_stock()) {
return false;
}
}
return true;
}
//VICTIME SUCESS
function bbloomer_archive_custom_cart_button_text($text)
{
global $product;
if (($product && !$product->is_type('variable') && !$product->is_in_stock()) || ($product && $product->is_type('variable') && is_variable_product_out_of_stock($product))) {
return 'Victime de son succès!';
} else return "";
// return $text;
}
// TRIE POPULAIRE
add_filter('woocommerce_default_catalog_orderby', 'misha_default_catalog_orderby');
function misha_default_catalog_orderby($sort_by)
{
return 'popularity';
}
//EXPIRATION PANIER
add_filter('wc_session_expiring', 'filter_ExtendSessionExpiring');
add_filter('wc_session_expiration', 'filter_ExtendSessionExpired');
function filter_ExtendSessionExpiring($seconds)
{
return 60 * 60 * 240;
}
function filter_ExtendSessionExpired($seconds)
{
return 60 * 60 * 241;
}
// non actif
// add_action( 'woocommerce_before_shop_loop_item_title', 'wpm_display_sold_out_loop_woocommerce' );// On l'affiche sur la page boutique
// add_action( 'woocommerce_single_product_summary', 'wpm_display_sold_out_loop_woocommerce' );// On l'affiche sur la page du produit seul
// // function wpm_display_sold_out_loop_woocommerce() {
// // global $product;
// // //Si le produit est en rupture de stock, on affiche :
// // if ( !$product->is_in_stock() ) {
// // echo '
' . __( 'Victime de son succès', 'woocommerce' ) . ' ';
// // }
// // }
/* Page Produit */
// Transforme les variation dropdown en button
// Surcouche pour changer l'affichage des prix/gramme/economie.
function variation_radio_buttons_child($html, $args)
{
$args = wp_parse_args(apply_filters('woocommerce_dropdown_variation_attribute_options_args', $args), array(
'options' => false,
'attribute' => false,
'product' => false,
'selected' => false,
'name' => '',
'id' => '',
'class' => '',
'show_option_none' => __('Choose an option', 'woocommerce'),
));
if (false === $args['selected'] && $args['attribute'] && $args['product'] instanceof WC_Product) {
$selected_key = 'attribute_' . sanitize_title($args['attribute']);
$args['selected'] = isset($_REQUEST[$selected_key]) ? wc_clean(wp_unslash($_REQUEST[$selected_key])) : $args['product']->get_variation_default_attribute($args['attribute']);
}
$options = $args['options'];
$product = $args['product'];
$attribute = $args['attribute'];
$name = $args['name'] ? $args['name'] : 'attribute_' . sanitize_title($attribute);
$id = $args['id'] ? $args['id'] : sanitize_title($attribute);
$class = $args['class'];
$show_option_none = (bool)$args['show_option_none'];
$show_option_none_text = $args['show_option_none'] ? $args['show_option_none'] : __('Choose an option', 'woocommerce');
if (empty($options) && !empty($product) && !empty($attribute)) {
$attributes = $product->get_variation_attributes();
$options = $attributes[$attribute];
}
$radios = '
';
if (!empty($options)) {
if ($product && taxonomy_exists($attribute)) {
$terms = wc_get_product_terms($product->get_id(), $attribute, array(
'fields' => 'all',
));
$higherprice = "";
$pattern = "/^\d+g \([\d.,]+€\/g\)$/";
foreach ($terms as $term) {
if (preg_match($pattern, $term->name)) {
$labelText = $term->name;
$parts = explode(' ', $labelText);
$poids = $parts[0]; // La première partie est le poids avec G
$nbpoids = str_replace('g', '', $poids); // Permet de récuperer juste le nombre de G
$prix = str_replace('()', '', $parts[1]); // La deuxième partie est le prix, on supprime le Texte superflu
$nbprix = str_replace('€/g)', '', $prix);
$nbprix = str_replace('(', '', $nbprix);
if (str_contains($nbprix, ",")) {
$nbprix = str_replace(",", ".", $nbprix);
}
$total = $nbprix * $nbpoids;
if ($higherprice === "") {
$higherprice = $nbprix;
$save = 0;
if (preg_match('/^[^.,\D]+\.\d{1,1}$/', $total)) {
$total .= "0";
}
} else {
if (preg_match('/^\d{2,}.\d+$/', $total)) {
$parts = explode('.', $total);
$total = $parts[0];
}
$save = ceil((($nbprix - $higherprice) / $higherprice) * 100);
$save = str_replace("-", "", $save);
$save .= "%";
}
if (in_array($term->slug, $options, true)) {
$id = $name . '-' . $term->slug;
$radios .= '
name)) . '"> slug, false) . '>' . esc_html(apply_filters('woocommerce_variation_option_name', $total)) . " €" . " " . esc_html(apply_filters('woocommerce_variation_option_name', $poids)) . ($save !== 0 ? " Economisez " . esc_html(apply_filters('woocommerce_variation_option_name', $save)) . ' ' : "") . '
';
}
} else {
if (in_array($term->slug, $options, true)) {
$id = $name . '-' . $term->slug;
$radios .= '
name)) . '"> slug, false) . '>' . esc_html(apply_filters('woocommerce_variation_option_name', $term->name)) . '
';
}
}
}
} else {
foreach ($options as $option) {
$id = $name . '-' . $option;
$checked = sanitize_title($args['selected']) === $args['selected'] ? checked($args['selected'], sanitize_title($option), false) : checked($args['selected'], $option, false);
$radios .= '
name)) . '">' . esc_html(apply_filters('woocommerce_variation_option_name', $option)) . '
';
}
}
}
$radios .= '
';
return $html . $radios;
}
add_filter('woocommerce_dropdown_variation_attribute_options_html', 'variation_radio_buttons_child', 20, 2);
function child_remove_parent_variation_radio_buttons()
{
remove_filter('woocommerce_dropdown_variation_attribute_options_html', 'variation_radio_buttons', 20, 2);
}
add_action('wp_loaded', 'child_remove_parent_variation_radio_buttons');
// MOVE LA SHORT DESCRIPTION
add_action('wp_head', 'move_short_desc_for_varition');
function move_short_desc_for_varition()
{
#
global $post;
if (is_product()) {
$product = get_product($post->ID);
if ($product->is_type('variable')) {
add_action('woocommerce_after_add_to_cart_form', 'woocommerce_template_single_excerpt');
}
}
}
// BREACRUMB
function custom_breadcrumbs()
{
// Settings
$separator = '/';
$breadcrums_id = 'breadcrumbs';
$breadcrums_class = 'breadcrumbs';
$home_title = 'Accueil';
// If you have any custom post types with custom taxonomies, put the taxonomy name below (e.g. product_cat)
$custom_taxonomy = 'product_cat';
// Get the query & post information
global $post, $wp_query;
// Do not display on the homepage
if (!is_front_page()) {
// Build the breadcrums
echo '
';
// Home page
echo '' . $home_title . ' ';
echo ' ' . $separator . ' ';
if (is_archive() && !is_tax() && !is_category() && !is_tag()) {
echo '' . post_type_archive_title($prefix, false) . ' ';
} else if (is_archive() && is_tax() && !is_category() && !is_tag()) {
// If post is a custom post type
$post_type = get_post_type();
// If it is a custom post type display name and link
if ($post_type != 'post' && $post_type != 'product' && $post_type != false) {
$post_type_object = get_post_type_object($post_type);
$post_type_archive = get_post_type_archive_link($post_type);
echo '' . $post_type_object->labels->name . ' ';
echo ' ' . $separator . ' ';
}
$custom_tax_name = get_queried_object()->name;
echo '' . $custom_tax_name . ' ';
} else if (is_single()) {
// If post is a custom post type
$post_type = get_post_type();
// If it is a custom post type display name and link
if ($post_type != 'post' && $post_type != 'product') {
$post_type_object = get_post_type_object($post_type);
$post_type_archive = get_post_type_archive_link($post_type);
echo '' . $post_type_object->labels->name . ' ';
echo ' ' . $separator . ' ';
}
// Get post category info
$category = get_the_category();
if (!empty($category)) {
// Get last category post is in
$last_category = end(array_values($category));
// Get parent any categories and create array
$get_cat_parents = rtrim(get_category_parents($last_category->term_id, true, ','), ',');
$cat_parents = explode(',', $get_cat_parents);
// Loop through parent categories and store in variable $cat_display
$cat_display = '';
foreach ($cat_parents as $parents) {
$cat_display .= '' . $parents . ' ';
$cat_display .= ' ' . $separator . ' ';
}
}
// If it's a custom post type within a custom taxonomy
$taxonomy_exists = taxonomy_exists($custom_taxonomy);
if (empty($last_category) && !empty($custom_taxonomy) && $taxonomy_exists) {
$taxonomy_terms = get_the_terms($post->ID, $custom_taxonomy);
$cat_id = $taxonomy_terms[0]->term_id;
$cat_nicename = $taxonomy_terms[0]->slug;
$cat_link = get_term_link($taxonomy_terms[0]->term_id, $custom_taxonomy);
$cat_name = $taxonomy_terms[0]->name;
}
// Check if the post is in a category
if (!empty($last_category)) {
echo $cat_display;
echo '' . get_the_title() . ' ';
// Else if post is in a custom taxonomy
} else if (!empty($cat_id)) {
echo '' . $cat_name . ' ';
echo ' ' . $separator . ' ';
echo '' . get_the_title() . ' ';
} else {
echo '' . get_the_title() . ' ';
}
} else if (is_category()) {
// Category page
echo '' . single_cat_title('', false) . ' ';
} else if (is_page()) {
// Standard page
if ($post->post_parent) {
// If child page, get parents
$anc = get_post_ancestors($post->ID);
// Get parents in the right order
$anc = array_reverse($anc);
// Parent page loop
if (!isset($parents)) $parents = null;
foreach ($anc as $ancestor) {
$parents .= '' . get_the_title($ancestor) . ' ';
$parents .= ' ' . $separator . ' ';
}
// Display parent pages
echo $parents;
// Current page
echo ' ' . get_the_title() . ' ';
} else {
// Just display current page if not parents
echo ' ' . get_the_title() . ' ';
}
} else if (is_tag()) {
// Tag page
// Get tag information
$term_id = get_query_var('tag_id');
$taxonomy = 'post_tag';
$args = 'include=' . $term_id;
$terms = get_terms($taxonomy, $args);
$get_term_id = $terms[0]->term_id;
$get_term_slug = $terms[0]->slug;
$get_term_name = $terms[0]->name;
// Display the tag name
echo '' . $get_term_name . ' ';
} elseif (is_day()) {
// Day archive
// Year link
echo '' . get_the_time('Y') . ' Archives ';
echo ' ' . $separator . ' ';
// Month link
echo '' . get_the_time('M') . ' Archives ';
echo ' ' . $separator . ' ';
// Day display
echo ' ' . get_the_time('jS') . ' ' . get_the_time('M') . ' Archives ';
} else if (is_month()) {
// Month Archive
// Year link
echo '' . get_the_time('Y') . ' Archives ';
echo ' ' . $separator . ' ';
// Month display
echo '' . get_the_time('M') . ' Archives ';
} else if (is_year()) {
// Display year archive
echo '' . get_the_time('Y') . ' Archives ';
} else if (is_author()) {
// Auhor archive
// Get the author information
global $author;
$userdata = get_userdata($author);
// Display author name
echo '' . 'Author: ' . $userdata->display_name . ' ';
} else if (get_query_var('paged')) {
// Paginated archives
echo '' . __('Page') . ' ' . get_query_var('paged') . ' ';
} else if (is_search()) {
// Search results page
echo 'Search results for: ' . get_search_query() . ' ';
} elseif (is_404()) {
// 404 page
echo '' . 'Erreur 404' . ' ';
}
echo ' ';
}
}
/**
* Remove WooCommerce breadcrumbs
*/
add_action('init', 'my_remove_breadcrumbs');
function my_remove_breadcrumbs()
{
remove_action('woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0);
}
/* Script JS pour afficher le prix & ouvrir le SideCart lors du click sur bouton */
function frequently_bought_together_scripts()
{
// wp_enqueue_script('NOM', get_stylesheet_directory_uri() . '/custom.js', array( 'jquery' ), NULL, false);
if (is_product()) {
wp_enqueue_script('frequently-bought-together', get_stylesheet_directory_uri() . '/assets/js/frequently-bought-together.js', array());
}
}
add_action('wp_footer', 'frequently_bought_together_scripts');
/* Replace la newsletter apres le bloc de Frequently bought together */
function newsletters_replace_on_product_page()
{
if (is_product()) {
if (has_term('les-premium', 'product_cat')) {
?>
Recevoir les bon plans golden en avant premiere et des 🎁
'product',
'posts_per_page' => -1,
'post_status' => 'publish',
'meta_query' => array(
array(
'key' => '_stock_status',
'value' => 'instock',
),
array(
'key' => '_stock',
'value' => 0,
'compare' => '>',
'type' => 'NUMERIC',
),
),
'date_query' => array(
array(
'after' => '90 days ago',
),
),
);
$products = new WP_Query($args);
$count = $products->found_posts;
if ($count === 1) {
echo '
' . $count . ' résultat affiché
';
} else {
echo '
' . $count . ' résultats affichés
';
}
echo "
";
if ($products->have_posts()) {
while ($products->have_posts()) {
$products->the_post();
wc_get_template_part('content', 'product');
}
} else {
echo __('Aucun produit trouvé', 'woocommerce');
}
echo " ";
wp_reset_postdata();
}
// On rajoute le checkout.css comme dans le theme parent
add_action('wfacp_internal_css', function () { ?>