0

网站标题未显示在浏览器标题栏中。

我在浏览器中看到了页面源代码,并注意到标签重复了。这可能是一个问题。我找不到重复。

这是我的 header.php 的代码

<!DOCTYPE html>
<!--[if IE 6]>
<html id="ie6" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 7]>
<html id="ie7" <?php language_attributes(); ?>>
<![endif]-->
<!--[if IE 8]>
<html id="ie8" <?php language_attributes(); ?>>
<![endif]-->
<!--[if !(IE 6) | !(IE 7) | !(IE 8)  ]><!-->
<html <?php language_attributes(); ?>>
<!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<meta name="viewport" content="width=device-width" />

<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', 'oscar' ), max( $paged, $page ) );

    ?></title>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>

<?php

    if ( is_singular() && get_option( 'thread_comments' ) )
        wp_enqueue_script( 'comment-reply' );

    wp_head();

?>

</head>

<body <?php body_class(); ?>>
4

3 回答 3

2

查看您的源代码,您有 2 个doctypes、、html和标签。你需要弄清楚这些是从哪里来的。部件上方可能有 html 标签。head, bodytitle<?php get_header(); ?>

是你自己的主题吗?

更新
要弄清楚这是从哪里来的,请停用所有插件。
如果这有助于将它们一一打开,看看是哪一个做到了。

如果那没有帮助。关闭fucntions.php(暂时重命名)。
如果这没有帮助,请给我们您主题中所有 (php) 文件的列表。

于 2012-08-16T07:24:04.447 回答
1

问题是,Wordpress 试图打印错误或警告信息。但'WP_DEBUG'WP_CONFIG.PHP. 我只是define('WP_DEBUG', false);define('WP_DEBUG', true);

它显示了一些警告信息。

于 2012-08-16T08:19:01.600 回答
0

不在页面中显示标题的原因正是这个 - 有 2 个headtitle标签,并关闭head标签两次。这意味着,要么某些插件在每个页面中都包含某些内容,要么您在 PHP 中使用自动前置文件。检查“php.ini”配置文件中的这些行:

; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
auto_prepend_file =

; Automatically add files after PHP document.
; http://php.net/auto-append-file
auto_append_file =
于 2012-08-16T08:36:44.000 回答