首页 文章

用产品更改wordpress主页

提问于
浏览
0

我有一个用于woocommerce的i-craft wordpress主题

我想设置一个静态主页,但主题在仪表板中不能很好地工作

我去主题的te index.php页面,我想改变这个:

<div class="blog-columns" id="blog-cols">
        <?php /* The loop normal posts */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'content', 'single-product-customcateg' ); //get_post_format() ?>
        <?php endwhile; ?>
        </div>

与woocommerce产品,但我不知道我怎么能做显示产品

有人帮我吗?非常感谢

1 回答

  • 0

    如果您只是想模仿WooCommerce如何通过Shortcode显示其产品,您可以这样做:

    <div class="blog-columns" id="blog-cols">
        <?php /* The loop normal posts */ ?>
        <?php while ( have_posts() ) : the_post(); ?>
            <?php get_template_part( 'content', 'single-product-customcateg' ); //get_post_format() ?>
            <?php echo do_shortcode('[product id="1"]') ?>
        <?php endwhile; ?>
    </div>
    

    只需将'id =“1”'参数替换为与WooCommerce中的产品相关联的产品ID即可

相关问题