wp_head加载到Wordpress中的body标签中

时间:2014-06-23 07:34:12

标签: php wordpress

我有一个Wordpress网站,今天早上我注意到wp_head()将内容输出到body代码。

以下是header.php

的代码
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
    <head>
        <meta charset="<?php bloginfo( 'charset' ); ?>">
        <meta name="viewport" content="width=device-width">
        <title><?php wp_title( '|', true, 'right' ); ?></title>
        <link rel="profile" href="http://gmpg.org/xfn/11">
        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
        <script>(function() {
            var _fbq = window._fbq || (window._fbq = []);
            if (!_fbq.loaded) {
            var fbds = document.createElement('script');
            fbds.async = true;
            fbds.src = '//connect.facebook.net/en_US/fbds.js';
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(fbds, s);
            _fbq.loaded = true;
           }
           _fbq.push(['addPixelId', 'xxx']);
          })();
          window._fbq = window._fbq || [];
          window._fbq.push(['track', 'PixelInitialized', {}]);
        </script>
        <noscript><img height="1" width="1" alt="" style="display:none"                    src="https://www.facebook.com/tr?id=xxx&amp;ev=NoScript" /></noscript>

        <script type="text/javascript">
           /* <![CDATA[ */
           var google_conversion_id = xxxx;
           var google_custom_params = window.google_tag_params;
           var google_remarketing_only = true;
           /* ]]> */
        </script>
        <script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
        </script>
        <noscript>
            <div style="display:inline;">
            <img height="1" width="1" style="border-style:none;" alt="" src="//googleads.g.doubleclick.net/pagead/viewthroughconversion/xxxx/?value=0&amp;guid=ON&amp;script=0"/>
            </div>
        </noscript>

       <?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
    <div id="page" class="hfeed site">
<?php do_action( 'before' ); ?>
<header id="masthead" class="site-header" role="banner">
    <div class="container">
        <div class="row">
            <div class="site-branding col-sm-4">
                <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><img src="<?php echo home_url(); ?>/wp-content/uploads/2014/06/Logo-nov-.png" alt="<?php bloginfo( 'name' ); ?>"/></a></h1>

            </div>

        <div class="col-sm-8 mainmenu">
        <div class="mobilenavi"></div>
                <?php wp_nav_menu( array( 'container_id' => 'submenu', 'theme_location' => 'primary','container_class' => 'topmenu','menu_id'=>'topmenu' ,'menu_class'=>'sfmenu' ) ); ?>
        </div>

        </div> <!-- end row -->
    </div>
</header><!-- #masthead -->


<?php if( is_page_template('homepage.php') ){ get_template_part( 'inc/feature' ); } ?>

<div id="content" class="site-content ">

我尝试删除再营销代码,但没有任何区别。此外,我已经尝试禁用所有插件,但仍然没有去

1 个答案:

答案 0 :(得分:0)

好的,根据Matt Gibson的评论,我找到了解决方案。不是完美的,但它是一种有效的解决方案。

我已经wp_head()向上移动,就在<link rel="pingback">...蚂蚁现在正常工作之后。