您当前的位置:首页 > TAG信息列表 > wp-register-script
WP_REGISTER_SCRIPT(...$in_footer=TRUE)不起作用
我想在我的页脚中加载一些javascript文件。我试着在functions.php 像这样:function my_init() { // LOAD JQUERY wp_deregister_script(\'jquery\'); wp_register_script(\'jquery\', \'//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js\',$deps =
jQuery plugin not loading
我正在尝试使用下面的函数生成2个脚本(一个内部脚本,一个外部脚本)。内部的一个(\'custom\\u script\')正在工作,但第二个(\'formValidation\')没有工作(我得到一个“validate()不是函数”错误)。验证是指向脚本的外部链接。我做错了吗?如果是这样,正确的方法是什么? function smartdeploy_scripts() { // register your script location, dependencies and versi
如何取消`wp_print_scripts`?
我想在中加载所有脚本$wp_scripts 在window.onload 事件有没有简单的方法来预防wp_print_scripts 从打印默认列表<script> 标记以便我可以用自己的代码替换它?
未显示注册脚本版本
我想在特定脚本上实现缓存破坏,但该版本并没有作为查询变量添加到url中。下面是我使用的代码:wp_register_script( \'custom\', get_stylesheet_directory_uri() . \'/js/custom.min.js\', array(\'jquery\',\'modernizr\'), filemtime( get_stylesheet_directory().\'/js/custom.min.js\' ), true ); 我正在使用filemti
WP_ENQUEUE_SCRIPTS无效
我正在为创建一个主题Wordpress, 但是wp_enqueue_scripts 不起作用。中的代码functions.php 是:<?php function scripts_and_styles() { if ( ! is_admin() ) { wp_enqueue_script( \'jQuery\' ); wp_register_style( \'style.css\',get_template_directory_u
如何注册版本为空值的脚本?
有人能解释一下wp_register_script()? 根据法典added to the URL as a query string for cache busting purposes. 它还说如果$ver 参数设置为null, 未添加版本,如果false, 添加了当前安装的WordPress版本。如何设置$ver 参数到null? 我想我在下面使用的代码中有,但它添加了当前安装的WordPress版本作为版本号。function add_ajax_script() { wp_regi
如何在WP页面的脚本中获取WP入队脚本(在Functions.php中)?
我对WP和JS都很陌生,需要对现有代码做一个简单的更改,所以请原谅我的无知…为了获取当前的用户Id,我遵循示例并在函数中添加了一个action+函数。我的孩子主题的php(粘贴在下面)现在我需要在<script>…. </script> 我试图将其分配到一个var中,但失败了(下面还粘贴了一个示例脚本部分,其中包含不起作用的分配)。How do I do that right? Added to functions.php: add_action(\'in
何时使用wp_Register_script()函数?
当我了解到函数wp\\u register\\u script()时,我想到了一些问题:我应该先注册每个脚本,然后将其排队吗?这是最佳实践吗?或者,我通常不应该注册每个脚本吗?