Quantcast
Channel: Display html for selected products or products categories - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Display html for selected products or products categories

$
0
0

Hello I am using advanced custom field plugin for displaying some html only for selected products or only for products for selected categories in option page with relationship picker. My result instead is displaying for all products. This is what I have:

$products = get_field('products_picker', 'option');$categories =  get_field('categories_picker', 'option');$prom_img = get_field('prom_img', 'option');if ( $products ) {foreach( $products as $p ):       if( $post->ID == $p->ID ):<img src="<?php echo  $prom_img['url']; ?>">    endif;endforeach;} if ( $categories ) {foreach( $categories as $term ):       $category = get_term( $term );   if( has_term( $category, 'product_cat', $post )) {      ?><img src="<?php echo  $prom_img['url']; ?>">    endif;endforeach;}

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images