我正在尝试修复子菜单的问题。我已经编写了代码(如您在JSFIDLE上看到的):http://jsfiddle.net/8899x/87/ ) 我的水平菜单和子菜单。当我在所选子页面时,我想让子菜单保持打开状态;例如,如果单击“Gallery->Photogallery 1”,我希望子菜单和“Photogallery 1”保持打开并高亮显示。如果我点击“Photogallery 2”等等,显然也是一样的。
有什么帮助吗?
UPDATED:下面是我的标题示例。php:
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( \'charset\' ); ?>" />
<meta name="viewport" content="width=device-width, initial-scale=0.1, maximum-scale=1.0"/>
<title><?php
global $page, $paged;
wp_title( \'|\', true, \'right\' );
// Add the blog name.
bloginfo( \'name\' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( \'description\', \'display\' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
echo \' | \' . sprintf( __( \'Page %s\', \'_s\' ), max( $paged, $page ) );
?></title>
<link href=\'http://fonts.googleapis.com/css?family=Open+Sans:800,400,600,700\' rel=\'stylesheet\' type=\'text/css\'>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<link rel="shortcut icon" href="<?php bloginfo(\'template_url\'); ?>/favicon.ico" type="image/vnd.microsoft.icon"/>
<link rel="icon" href="<?php bloginfo(\'template_url\'); ?>/favicon.ico" type="image/x-ico"/>
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="wrapper" class="container">
<ul id="navbar">
<li><a href="<?php bloginfo(\'url\') ?>">Home</a></li>
<li><a href="<?php bloginfo(\'url\') ?>/?page_id=258"
<?php
if ( is_page(\'258\') || is_page(\'300\') || ( !is_home() && in_category(\'5\')) || ( !is_home() && in_category(\'58\')) )
{
echo " class=\\"selected\\"";
}
?>>Gallery</a>
<ul>
<li><a href="<?php bloginfo(\'url\') ?>/?page_id=258">Photogallery 1</a></li>
<li><a href="<?php bloginfo(\'url\') ?>/?p=256">Photogallery 2</a></li>
<li><a href="<?php bloginfo(\'url\') ?>/?page_id=300">Photogallery 3</a></li>
</ul>
</li>
<li><a href="events.php">Events</a></li>
<li><a href="#">Blog</a>
<ul class="submenu">
<li><a href="personal.php">Personal</a></li>
<li><a href="dev.php">Dev</a></li>
</ul>
</li>
<li><a href="#">About</a>
<ul class="submenu">
<li><a href="page1.php">Page 1</a></li>
<li><a href="page2.php">Page 2</a></li>
</ul>
</li>
</ul>
<div class="clear"></div>
<div id="main">
以及singlecustompage的一些行。php:
<?php get_header(); ?>
<div id="full-content">