首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >呼叫woocommerce产品时的致命错误

呼叫woocommerce产品时的致命错误
EN

Stack Overflow用户
提问于 2018-12-07 14:15:25
回答 1查看 1K关注 0票数 1

如何纠正此错误?我开始通过查询调用产品,但我遇到了这个问题--我认为问题在于打开和关闭PHP标记,但我无法修复它

致命错误:未定义错误:调用C:\xampp\htdocs\gptec\fa\wp-content\themes\gptec_wptheme\index.php:102堆栈跟踪中的未定义方法WC_Product_Simple::have_posts():#0 C:\xampp\htdocs\gptec\fa\wp-includes\template-loader.php(74):include() #1 C:\xampp\htdocs\gptec\fa\wp-blog-header.php(19):require_once('C:\xampp\htdocs )。.‘) #2 C:\xampp\htdocs\gptec\fa\index.php(17):要求(’C:\xampp\htdocs.‘) #3 {main}抛入第102行的C:\xampp\htdocs\gptec\fa\index.php中

我的密码:

代码语言:javascript
复制
<div class="row">
<?php
$product=new WP_Query(
        array(
                'post_type'=>'product',
                 'post_per_page'=>6

        )
);



?>

<?php
    if ($product->have_posts())
    {
    while ($product->have_posts())
    $product->the_post();
    { ?>
    <div class="col-lg-3  p-2 m-2" >
        <div class="card card-4 text-center cls">
            <?php  the_post_thumbnail(); ?>
            <div class="clearfix"></div>
            <span class="description-text pb-1 mb-1"><?php  the_title()?></span>
            <div class="clearfix"></div>
            <a href="<?php  the_permalink() ?>">
                <button type="button" class="btn btn-outline-success slideright p-2 m-2">مشاهده محصول</button>
            </a>
        </div>
    </div>
    <?php }}?>     <!--Card-->

</div>
EN

回答 1

Stack Overflow用户

发布于 2018-12-07 16:10:00

$product在伍尔商业是全球性的。所以你犯了错误。

所以使用其他变量来代替$product

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53671325

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档