我在使用wordpress时遇到问题,并将响应主题(来自http://cyberchimps.com/)进行了幼儿化。
这是网站http://www.mas-seraphin.com/la-bergerie/,但你需要在213.186.33.4上覆盖主机文件www.mas-seraphin.com
这是我的子主题的css文件:
/*
Theme Name: Responsive Child : mas-seraphin
Theme URI: http://www.mas-seraphin.com/wp-content/themes/mas-seraphin_responsive-child
Description: Responsive Child : mas -seraphin
Author: Emerik NICOLE
Author URI: http://www.e-nicole.info
Template: responsive
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: Responsive Child : mas-seraphin
*/
#mega-menu-wrap-header-menu {
clear: both;
margin: 0 auto;
background-color: #b06df4 !important;
background-image: -webkit-gradient(linear, left top, left bottom, from(#b06df4), to(#b06df4)) !important;
background-image: -webkit-linear-gradient(top, #b06df4, #b06df4) !important;
background-image: -moz-linear-gradient(top, #b06df4, #b06df4) !important;
background-image: -ms-linear-gradient(top, #b06df4, #b06df4) !important;
background-image: -o-linear-gradient(top, #b06df4, #b06df4) !important;
background-image: linear-gradient(top, #b06df4, #b06df4) !important;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b06df4, endColorstr=#3d3d3d);
}
#wrapper {
clear: both;
position: relative;
margin: 20px auto;
padding: 0px 20px 20px;
border: 1px solid #E5E5E5;
border-radius: 4px;
background-color: #f2cb8a !important;
}
这是子主题
的functions.php<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
add_action('wp_footer','customized_js');
function theme_enqueue_styles() {
wp_enqueue_style(
'parent-style',
get_template_directory_uri() . '/style.css',
array()
);
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array('parent-style')
);
}
if (!function_exists('customized_js')) {
function customized_js(){
echo get_stylesheet_directory_uri()."ter";
echo get_stylesheet_directory_uri(). '/js/my-jquery-div-slide-effect.js';
wp_deregister_script( 'jquery' );
wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js');
wp_enqueue_script('jquery');
wp_register_script(
'my-jquery-div-slide-effect',
get_stylesheet_directory_uri(). '/js/my-jquery-div-slide-effect.js',
array('jquery'),
'1.0',
True
);
wp_enqueue_scripts('my-jquery-div-slide-effect');
}
}
?>
我想通过点击wordpress页面的链接在div上添加显示/隐藏功能。所以我加载一个自定义的js文件my-jquery-div-slide-effect.js:
jQuery(document).ready(function() {
jQuery('#tarifs').hide();
jQuery('a#tarif_title').click(function() {
jQuery('#tarifs').slideToggle(400);
return false;
});
});
当我查看firebug时,似乎没有加载my-jquery-div-slide-effect.js,而css over over就是运行良好。
你能指出我做错了吗?
答案 0 :(得分:0)
您的代码中存在拼写错误:
wp_enqueue_scripts('my-jquery-div-slide-effect');
应该是
wp_enqueue_script('my-jquery-div-slide-effect');