首页 文章

将WooCommerce Hook添加到Wordpress页面

提问于
浏览
0

我正在尝试使用wordpress和WooCommerce构建一个单页的网站 . 该页面将有四个主要块:

1-简介文本:在页面中插入冷内容

2-滑块中某类帖子

3-滑块中不同类别的帖子

4-商店:网格查看商店中的所有产品 .

在这里's something that would work sort of like i want (sorry for the design of that thing, it' s残酷!):http://westy.premiumcoding.com/

为此,我创建了一个几乎空的page-home.php文件,以及一个空的“home”页面,我将其设置为默认首页 .

要挂钩第1部分,我认为很容易获取精确页面的内容对于第2部分和第3部分,我将使用我的php文件创建循环,并使用一些get_post技巧

最重要的问题是第4部分:我们如何直接在php页面中从模板访问WooCommerce内容?

感谢大家的提示!

1 回答

  • 3

    您可以在php文件中使用此代码列出所需的woocommerce产品

    <?php
        echo do_shortcode('[product_category category="category name" per_page="12"  columns="2"]'); 
        ?>
    

相关问题