Wordpress导航在文章,博客和文章等页面中不可见搜索

时间:2010-04-08 14:11:17

标签: php wordpress wordpress-theming

我的wordpress *(自定义模板)*导航正在所有页面上工作,但现在我发现主导航没有显示在此pages

所有网页,例如search.php,single.php,index.php,page.php都有<?php get_header(); ?>

我真的不知道什么是错的。

以下是我的header.php的代码

    <?php
/**
 * @package WordPress
 * @subpackage Default_Theme
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes() ?>>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen,projection" />
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/sifr.css" type="text/css" />

<script src="<?php bloginfo('template_url'); ?>/js/sifr.js" type="text/javascript"></script>
<script src="<?php bloginfo('template_url'); ?>/js/sifr-config.js" type="text/javascript"></script>
<script src="http://cdn.jquerytools.org/1.1.2/jquery.tools.min.js"></script>

<?php wp_head(); ?>
</head>
<?php
 $current_page = $post->ID;
 $parent = 1;

 while($parent) {
  $page_query = $wpdb->get_row("SELECT post_name, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
  $parent = $current_page = $page_query->post_parent;
  if(!$parent) $parent_name = $page_query->post_name;
 }
?>
<body id="<?php echo (is_page()) ? "$parent_name" : ((is_home()) ? "blog" : ((is_search()) ? "other" : ((is_single()) ? "blog" : "blog"))); ?>">
<div id="BGtie">

<!--HEAD WRAPPER-->
<div id="headwrapper">

<!--HEADER-->
<div id="headContainer">

<div id="nameTag">
<a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a>
</div>

<!--TOP NAV-->
<div id="topNav">
<ul>
<li><a href="<?php bloginfo('url'); ?>home">Home</a></li>
<li><a href="#">Request info</a></li>
<li><a href="#">Contact us</a></li>
<?php do_action('icl_language_selector'); ?>
</ul>


</div>
<!--END TOP NAV-->

<!--MAIN NAV-->
<?php if ( is_page() AND (strtolower(ICL_LANGUAGE_CODE) == 'fr') ) {include("main-nav-fr.php");} ?>
<?php if (is_page() AND (strtolower(ICL_LANGUAGE_CODE) == 'en')) include("main-nav-en.php") ?>
<!--END MAIN NAV-->

</div>
<!--END HEADER-->

</div>

<!--END HEAD WRAPPER-->
</div>

1 个答案:

答案 0 :(得分:1)

<!--MAIN NAV-->
<?php if ( is_page() AND (strtolower(ICL_LANGUAGE_CODE) == 'fr') ) {include("main-nav-fr.php");} ?>
<?php if (is_page() AND (strtolower(ICL_LANGUAGE_CODE) == 'en')) include("main-nav-en.php") ?>
<!--END MAIN NAV-->

is_page()在博文中返回false。删除is_page,你应该没事。

进一步阅读 - http://codex.wordpress.org/Conditional_Tags