小编Md *_*sin的帖子

我需要在woocommerce中添加自定义查询并添加到购物车按钮动态代码?

我为我的WordPress网站制作了自定义模板.所以我需要动态地在我的自定义模板中显示我的产品.我怎样才能做到这一点?

这是我的HTML代码 - >

             <div class="all_content_shop">
                <div class="col-md-3 single_all_c_s"> 
                    <div class="shop_product_inner"> 
                        <a href="<?php echo get_permalink( $loop->post->ID ) ?>">
                            <img src="http://jetsetbabies.com/wp-content/uploads/2006/07/100Juice_Organic_Apple_MAIN_v2.jpg" alt="Prduct Image" />
                            <div class="shop_product_inner_caption"> 
                                <h2>Product Title</h2>
                                <p>$200</p>
                                <a href="">Add to Cart</a>
                            </div>
                        </a>
                    </div>
                </div>
            </div>
Run Code Online (Sandbox Code Playgroud)

================================================

另外我是简单的查询,但我没有找到添加到购物车按钮动态代码???

这是我的查询代码---->

                <div class="all_content_shop">

                    <?php $new_posts = new WP_Query(array(
                    'post_type' => 'product', //post of page of my post type
                    'cat' => 0, // category id, 0 for all categories. 
                    'posts_per_page' => 12, 
                    'offset' => 0, //how many posts you want to eliminate …
Run Code Online (Sandbox Code Playgroud)

php mysql wordpress woocommerce

3
推荐指数
1
解决办法
8689
查看次数

标签 统计

mysql ×1

php ×1

woocommerce ×1

wordpress ×1