我不能出于某种原因让wordpress/wp-admin页面执行一个简单的查询文件.它只能在我的theme.php中取消注册我的主题文件夹中的jquery,但是我必须分别重新注册所有jquery.ui文件,这是乏味的.我使用wordpress 3.0多站点安装.我试图不触及核心wp文件.
它将在源文件中显示并链接到文件ok,但不会执行脚本.继承人我的函数.php:
function my_script() {
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js', false, '1.4.4');
wp_enqueue_script('jquery');
wp_enqueue_script('custom_script', get_bloginfo('template_url').'/js/myScript.js', array('jquery'));
}
if(is_admin()){
wp_enqueue_script('custom_admin_script', get_bloginfo('template_url').'/js/admin_script.js', array('jquery'));
} }
Run Code Online (Sandbox Code Playgroud)
add_action('init','my_script');
这是我的jquery文件(admin_script.js):
$(document).ready(function(){
alert("Hello"); });
Run Code Online (Sandbox Code Playgroud)
任何帮助都会很棒.
在 Angular 15.1.x 项目中,我尝试使用 NgOptimizedImage 实现一个在移动和桌面上响应的图像。强制的 img 宽度和高度属性将覆盖尺寸属性。
<img ngSrc="image.png" width="617" height="505" sizes="(max-width: 768px) 276w, 317w">。
根据文档,这应该意味着如果视口 768 像素或更小的图像宽度应显示 276 像素宽,否则显示 317 像素。我按照文档使用宽度/高度的内在函数。无论宽度/高度属性是多少(617 像素 X 505 像素),图像始终显示。
本质上我正在尝试实现这一目标,但使用 ngSrc:
<img src="image.png" srcset="img.png 617w" sizes="(max-width: 768px) 276px, 317px" >