Recent Posts

Caution: Greetings to all visitors. The site is working in short. Links Please skip the link to view any topic and thank you for visiting
header ads

Custom product loop excluding values with same name

Hello, I need to hide products with same title from WooCommerce shop page so i created a loop which is working and does hide products with same name but i have a problem.

If i set posts_per_page=8 it shows less because it counts the hidden products also.
<?php
$args = array('post_type'=>'product','posts_per_page'=>8);
$query =new WP_Query($args);
$list = array();

while($query->have_posts()): $query->the_post();if(in_array(get_the_title(), $list)){continue;}
$list[]=...
Code (markup):
Custom product loop excluding values with same name

from PHP https://ift.tt/38x8mGU
via IFTTT

Post a Comment

0 Comments