Wishlist
Last updated
Last updated
$wishlist_items = brtheme_get_wishlist_items();
if ( empty( $wishlist_items ) ) {
return [
'post_type' => 'product',
'posts_per_page' => -1,
'post__in' => [-1]
];
}
return [
'post_type' => 'product',
'posts_per_page' => -1,
'post__in' => $wishlist_items
];<?php
// Get wishlist items
$wishlist_items = brtheme_get_wishlist_items();
// Count the number of items in the wishlist
$wishlist_count = count($wishlist_items);
// Output the number of wishlist items
echo '<span class="brt-wishlist-items-count">' . $wishlist_count . '</span>';
// Check if the wishlist is empty and set query arguments accordingly
if ( empty( $wishlist_items ) ) {
// Return empty result if no items in the wishlist
$query_args = [
'post_type' => 'product',
'posts_per_page' => -1,
'post__in' => [-1]
];
} else {
// Return wishlist items query
$query_args = [
'post_type' => 'product',
'posts_per_page' => -1,
'post__in' => $wishlist_items
];
}
?>