我在jQuery'Superfish'下拉菜单(Wordpress)上工作。我使用最新版本的superfish和wordpress。问题是,superfish使我的菜单看不见......我什么都看不到我的菜单...
的functions.php
//Register Superfish
///////////////////////////////////////////////////////////
add_action( 'wp_enqueue_scripts', 'superfish_libs' );
function superfish_libs()
{
// Register each script, setting appropriate dependencies
wp_register_script('hoverintent', get_template_directory_uri() . '/superfish-js/hoverIntent.js');
wp_register_script('bgiframe', get_template_directory_uri() . '/superfish-js/jquery.bgiframe.min.js');
wp_register_script('superfish', get_template_directory_uri() . '/superfish-js/superfish.js', array( 'jquery', 'hoverintent', 'bgiframe' ));
wp_register_script('supersubs', get_template_directory_uri() . '/superfish-js/supersubs.js', array( 'superfish' ));
// Enqueue supersubs, we don't need to enqueue any others in this case, as the dependencies take care of it for us
wp_enqueue_script('supersubs');
// Register each style, setting appropriate dependencies
wp_register_style('superfishbase', get_template_directory_uri() . '/superfish-css/superfish.css');
wp_register_style('superfishvert', get_template_directory_uri() . '/superfish-css/superfish-vertical.css', array( 'superfishbase' ));
wp_register_style('superfishnavbar', get_template_directory_uri() . '/superfish-css/superfish-navbar.css', array( 'superfishvert' ));
// Enqueue superfishnavbar, we don't need to enqueue any others in this case either, as the dependencies take care of it
wp_enqueue_style('superfishnavbar');
}
//Register jQuery 1.1.3
///////////////////////////////////////////////////////////
wp_deregister_script('jquery');
if(!is_admin()) {
wp_register_script('jquery', get_template_directory_uri() . '/js/jquery-1.1.3.js');
wp_enqueue_script('jquery');
}
的header.php
<div id="wrapper-mainnav">
<div class="left"></div>
<div class="content">
<?php wp_nav_menu(array('theme_location' => 'mainnav', 'menu_class' => 'sf-menu')); ?>
</div>
<div class="right"></div>
<br class="clearer">
<div class="bottom"></div>
</div><!--wrapper-mainnav-->
请帮忙,我找不到错...请告诉我,如果您需要更多信息......
答案 0 :(得分:0)
首先,don't dequeue WordPress bundled jQuery。
似乎有点难以将类sf-menu
添加到<ul>
容器中。它被应用于上部<div>
我在wp_nav_menu
中尝试了许多变种,但无济于事。
一个简单的解决方案是手动更改
$mainnav = wp_nav_menu(array('theme_location' => 'mainnav', 'echo' => false );
echo str_replace( '<ul>', '<ul class="sf-menu">', $mainnav );