【问题标题】:Wordpress Categories: Trying to get property of non-objectWordpress 类别:试图获取非对象的属性
【发布时间】:2015-11-02 08:24:46
【问题描述】:

我是 Wordpress 的新手。我收到此错误:

注意:试图在 /mnt/stor10-wc1-ord1/825767/iucn.oceanic.net.fj/web/content/wp-content/plugins/super-socializer/super_socializer.php 中获取非对象的属性第 486 行

这是由我正在使用的“Super Socializer”插件引起的。它适用于其他页面,但我创建了一个自定义帖子类型并有 3 个类别。链接将其带到类别模板。例如:链接 a 显示类别 A 的帖子,链接 B 显示类别 B 的帖子等,

我的分类临时代码是这样的:

       <?php

                $args = array(
                    'posts_per_page' => 10,
                    'post_status' => 'publish',
                    'post_type' => 'oursuppliers',
                    'cat' => 35
                );
                query_posts($args);

                ?>



                <?php
                if ( have_posts() ): while ( have_posts() ) : the_post();
                    $post_title = get_the_title();
                    $post_author = $post->post_author;
                    $post_date = $post->post_date;
                    $link = get_field("resource-uploader");
                    $post_thumbnail_id = get_post_thumbnail_id( $id );
                    $thumbnail = wp_get_attachment_image_src( $post_thumbnail_id, "thumbnail");
                    $thumbnail = $thumbnail[0];
                    if( empty($thumbnail) ){
                        $thumbnail = get_template_directory_uri() . "/resources/images/default-150x150.jpg";
                    }
                    ?>
                    <div >
                        <ul style="list-style: none; ">
                            <li style="display: inline; margin: 3%; height: 350px; " class="col-md-3">
                                <div>
                                    <h5 style="font-weight: bold; color: #003399"><?php the_title() ?></h5>
                                </div>
                                <div>
                                    <a href="<?php the_permalink(); ?>">  <img style="width: 150px; height: 150px; align-content: center;"  src="<?php echo get_field("supplier_logo") ?>"/></a>
                                </div>

                            </li>
                        </ul>

                    </div>
                <?php endwhile; endif; wp_reset_query(); ?>
            </div>

谁能指导我如何消除该错误。反正我不需要这个模板上的分享插件...

提前谢谢你:)

【问题讨论】:

    标签: wordpress categories


    【解决方案1】:

    在大多数情况下,您完全不必担心 Wordpress 的通知,但最好通知插件的开发人员以便他们在未来的版本中修复它。

    如果您的网站运行正常并且您正在管理一个高效的网站,最好的方法应该是关闭调试消息。

    在您的 wp-config.php 文件中,将 WP_DEBUG 设置为 false:

    define('WP_DEBUG', false);

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-16
      • 1970-01-01
      • 2014-12-09
      相关资源
      最近更新 更多