【问题标题】:change wordpress homepage with product用产品更改 wordpress 主页
【发布时间】:2017-07-28 14:26:30
【问题描述】:

我有一个用于 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 的产品,但我不知道如何展示产品

有人帮我吗?非常感谢

【问题讨论】:

    标签: php wordpress woocommerce e-commerce


    【解决方案1】:

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

    <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

    【讨论】:

    • 对于多个产品,请改用此短代码:[products ids="1, 2, 3, 4, 5"]
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-05-31
    • 1970-01-01
    • 1970-01-01
    • 2016-05-13
    • 1970-01-01
    • 2015-09-11
    • 1970-01-01
    相关资源
    最近更新 更多