Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php print products with attribute

$all_ids = get_posts( array(
        'post_type' => 'product',
        'numberposts' => -1,
        'post_status' => 'publish',
        'fields' => 'ids',
		'tax_query' => array(
         array(
            'taxonomy' => 'pa_years', // Hover over "Configure terms" and look for taxonomy=pa_years in the link
            'field' => 'slug',
            'terms' => '2016', // Is the slug under "Configure terms"
            'operator' => 'IN',
         )
      ),
   ) );
   /*foreach ( $all_ids as $id ) {
        echo $id ."<br>";
   }*/
 
PREVIOUS NEXT
Tagged: #php #print #products #attribute
ADD COMMENT
Topic
Name
2+7 =