【发布时间】:2011-06-11 21:39:10
【问题描述】:
在这个网站上: http://jumpthru.net/newsite/vision/
我正在使用 CSS sprites 进行导航,并使用 PHP else 语句来显示当前页面的活动状态。除了包含循环/博客帖子(http://jumpthru.net/newsite/commentary/)的页面外,所有页面都正常工作
我需要为此页面调用不同的 php 吗?
PHP:
<?php
if ( is_page('vision') ) { $current1 = 'visionside a'; }
elseif ( is_page('team') ) { $current2 = 'teamside a'; }
elseif ( is_page('commentary') ) { $current3 = 'blogside a'; }
elseif ( is_page('organizations') ) { $current4 = 'orgside a'; }
?>
CSS:
#sidebarnav ul#sidenav li.<?php echo $current1; ?> {
background:url(http://jumpthru.net/newsite/wp-content/themes/twentyten/images/side/vision2.png) 0px -106px !important;
}
#sidebarnav ul#sidenav li.<?php echo $current2; ?> {
background:url(http://jumpthru.net/newsite/wp-content/themes/twentyten/images/side/team2.png) 0px -106px !important;
}
#sidebarnav ul#sidenav li.<?php echo $current3; ?> {
background:url(http://jumpthru.net/newsite/wp-content/themes/twentyten/images/side/content2.png) 0px -106px !important;
}
#sidebarnav ul#sidenav li.<?php echo $current4; ?> {
background:url(http://jumpthru.net/newsite/wp-content/themes/twentyten/images/side/org2.png) 0px -106px !important;
}
任何帮助将不胜感激!
【问题讨论】: