• I’ve created a short code which generating some custom post list and returning as a html element. Here is a example code:

        function shortcode(){
          $return_string = '';
           // query
           query_posts(array('post_type' => 'custom_post', 'orderby' => 'menu_order', 'order' => 'ASC', 'showposts' => -1));
           if (have_posts()) :
              while (have_posts()) : the_post();
                $return_string .= '<p>Hello</p>';
              endwhile;
           endif;
           wp_reset_query();
           return $return_string;
        }
        add_shortcode('shortcode', 'shortcode');

    Then using WooCommerce hook and shortcode together to show product list inside every single product on shop page. But it breaks shop column and showing all products in single column. Here is the code for action hook:

        function add_on_loop() {
        	echo do_shortcode('[shortcode]');
        }
        add_action( 'woocommerce_after_shop_loop_item', 'add_on_loop', 30);

    I tried removing the loop and then it works without any problem. Your help is very much appreciated.

  • The topic ‘WooCommerce shop products loop breaks in one column on adding custom post list’ is closed to new replies.