【发布时间】:2018-01-22 16:13:50
【问题描述】:
我想得到一些帮助。我的网站在搜索某些内容时不匹配并显示:
注意:试图在 /customers/3/a/2/**********ia.com/httpd.www/wp-content/themes.../ 中获取非对象的属性assets.php 在第 741 行
在那一行是:
if ( $is_product || is_post_type_archive( 'nitro-gallery' ) || is_singular( 'nitro-gallery' ) || ( is_single() && 'gallery' == $format ) || is_tax( 'gallery_cat' ) || has_shortcode( $post->post_content, 'product_page' ) ) {
wp_enqueue_style( 'nivo-lightbox' );
wp_enqueue_script( 'nivo-lightbox' );
}
【问题讨论】:
-
你应该用
is_product()替换$is_product......它应该会更好。 -
我只能猜测
$post不是一个对象。使用var_dump($post);验证其中包含的内容 -
大家好,通过 is_product() 改变 $is_product 没什么...
-
我不明白 var_dump($post);我该怎么办?
-
您可以简单地尝试在 if 语句中逐个添加条件,直到找到罪魁祸首。
标签: php wordpress search woocommerce product