Title: Do loop work?
Last modified: November 10, 2018

---

# Do loop work?

 *  [anneminford](https://wordpress.org/support/users/anneminford/)
 * (@anneminford)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/do-loop-work/)
 * Hi, I am trying to use this code that works when I don’t use the plugin but doesn’t
   return any results using the snippet shortcode. I think maybe loops don’t work
   but I can’t tell from the docs. Sorry if this has been covered before
 * ?>
 *  <div class=”btn-group”>
    <button type=”button” class=”btn btn-md btn-dark dropdown-
   toggle” data-toggle=”dropdown” aria-haspopup=”true” aria-expanded=”false”> Dropdown
   </button> <div class=”dropdown-menu”> <?php $args = array( ‘post_type’ => ‘product’,‘
   posts_per_page’ => 12, ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_visibility’,‘
   field’ => ‘name’, ), ), ); $loop = new WP_Query( $args ); while ( $loop->have_posts()):
   $loop->the_post(); global $product; ?> post->ID ) ?>”><?php echo esc_attr($loop-
   >post->post_title ? $loop->post->post_title : $loop->post->ID); ?> <?php endwhile;
   wp_reset_query(); ?> <div class=”dropdown-divider”></div> [Separated link](https://wordpress.org/support/topic/do-loop-work/?output_format=md#)
   </div> </div><!– end button group –>

Viewing 1 replies (of 1 total)

 *  [anumolxyzscripts](https://wordpress.org/support/users/anumolxyzscripts/)
 * (@anumolxyzscripts)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/do-loop-work/#post-10911987)
 * Hi,
    First sorry for the late reply. Loops works with Insert PHP Code Snippet.
   Please check your code.
 * Thank you

Viewing 1 replies (of 1 total)

The topic ‘Do loop work?’ is closed to new replies.

 * ![](https://ps.w.org/insert-php-code-snippet/assets/icon-128x128.png?rev=1800967)
 * [Insert PHP Code Snippet](https://wordpress.org/plugins/insert-php-code-snippet/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php-code-snippet/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php-code-snippet/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php-code-snippet/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php-code-snippet/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php-code-snippet/reviews/)

## Tags

 * [the-loop](https://wordpress.org/support/topic-tag/the-loop/)

 * 1 reply
 * 2 participants
 * Last reply from: [anumolxyzscripts](https://wordpress.org/support/users/anumolxyzscripts/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/do-loop-work/#post-10911987)
 * Status: not resolved