WP Query by custom attributes
-
Hey hello, first at all thank you so much for this plugin
I’m trying to get some products with a custom attribute but I doesn′t work.
My code is the next:
<?php $args = array( 'post_type' => 'product', 'meta_query' => array( array( 'key' => 'modelo', 'value' => 'pv16224' ) ) ); $loop = new WP_Query( $args ); if ( $loop->have_posts() ) { while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="col-xs-12 col-md-12"> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail('full'); ?></a> </div> <?php endwhile; } else { echo __( 'No se encuentran otros colores' ); } wp_reset_postdata(); ?>
But doesn’t work, i’m doing something wrong?
Thank you again for this plugin.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WP Query by custom attributes’ is closed to new replies.