我找不到这个问题。请帮助我
警告:使用未定义的常量jQuery-假定为“ jQuery”(此 会在将来的PHP版本中引发错误) D:\ xampp \ htdocs \ shihabseo \ wp-content \ themes \ consult \ inc \ enqueue.php在 第36行
答案 0 :(得分:0)
您是否偶然忘记使用$表示变量或忘记在函数名称上加上括号? 如果您可以共享代码段,那就更好了。
答案 1 :(得分:0)
用引号'jquery'将单词包装成字符串,现在您将其用作php constant
wp_enqueue_script('jquery','https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js', array(), null, true);
答案 2 :(得分:0)
您引用了以下代码:
wp_enqueue_script(
'jquery-magnific',
get_template_directory_uri() .'/assets/js/jquery.magnific-popup.min.js',
array(jquery),
'1.0.0',
'true');
(我将其分解为几行,以便于阅读/参考。)
wp_enqueue_script()
的参数为:
您的问题在参数#3中。大概这个“ jquery-magnific”库依赖于jQuery。在#3中指定它指示WP首先加载该库(如果可能)。
wp_enqueue_script(
'jquery-magnific',
get_template_directory_uri() .'/assets/js/jquery.magnific-popup.min.js',
array('jquery'),
'1.0.0',
'true');
更多改进:
['jquery']
。magnific-popup.min.js
脚本,而不是托管它并在本地加载它。答案 3 :(得分:0)
在数组中,您不需要我
更改此项: def greater(a,b):
if a > b:
return a
elif a==b:
return "equal"
else:
return b
def greatest(a,b,c):
if a>b and a>c:
return 'a'
elif a==b and a==c:
return "equal"
elif b > a and b > c:
return b
elif b==a and b==c:
return "equal"
elif c==a and c==b:
return "equal"
else:
return c
bigger = greater(1,1)
biggest = greatest(bigger,1,1)
print(biggest)
error:Traceback (most recent call last):
File "functions_execrise2.py", line 30, in <module>
biggest = greatest(bigger,1,1)
File "functions_execrise2.py", line 11, in greatest
if a>=b and a>=c:
TypeError: '>=' not supported between instances of 'str' and 'int'
为此: wp_enqueue_script('jquery-magnific', get_template_directory_uri() .'/assets/js/jquery.magnific-popup.min.js', array(jquery), '1.0.0', 'true');