WordPress的类别:试图获得非对象的属性 [英] Wordpress Categories: Trying to get property of non-object
问题描述
我是Wordpress的新手。我收到此错误:
I'm new to Wordpress. I'm getting this error:
注意:尝试获取/mnt/stor10-wc1-ord1/825767/iucn.oceanic.net中非对象的属性。第486行上的fj / web / content / wp-content / plugins / super-socializer / super_socializer.php
Notice: Trying to get property of non-object in /mnt/stor10-wc1-ord1/825767/iucn.oceanic.net.fj/web/content/wp-content/plugins/super-socializer/super_socializer.php on line 486
这是由于我正在使用 Super Socializer 。与其他页面配合使用效果很好,但是我创建了一个自定义帖子类型,并具有3个类别。链接将其带到类别模板。例如:链接a显示类别A的帖子,链接B显示类别B的帖子,等等,
This is caused by a plugin I'm using "Super Socializer". It works great with other pages but I have created a custom post type and have 3 categories. A link takes it to a category template. Eg: link a shows posts with category A, link B shows posts with category B etc,
我的类别临时代码如下:
My category Temp code is sth like this:
<?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>
有人可以指导我如何做吗b能够消除该错误。无论如何,我都不需要此模板上的共享插件...
Could anyone guide me on how I might b able to remove that error. I don't need the share plugin on this template anyways...
提前谢谢:)
推荐答案
在大多数情况下,Wordpress的通知都是您完全不必担心的,尽管最好通知插件的开发人员以便他们可以在将来的版本中对其进行修复。
Most of the time, Wordpress's notices are something that you don't have to worry at all, although it's a good idea to inform the plugin's developers so they can fix it in future versions.
如果您的站点正常运行并且您正在管理一个高效的站点,则最好的方法应该是关闭调试消息。
If your site works correctly and you are managing a productive site, the best approach should be turning off debug messages.
在您的 wp-config.php
文件中,将WP_DEBUG设置为false:
In your wp-config.php
file, set WP_DEBUG to false:
define('WP_DEBUG' ,false);
define('WP_DEBUG', false);
这篇关于WordPress的类别:试图获得非对象的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!