Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress广告:每次页面刷新都会在多个插件上产生3次广告印象(更新:随机,取决于谁的浏览量和浏览器))_Php_Wordpress - Fatal编程技术网

Php Wordpress广告:每次页面刷新都会在多个插件上产生3次广告印象(更新:随机,取决于谁的浏览量和浏览器))

Php Wordpress广告:每次页面刷新都会在多个插件上产生3次广告印象(更新:随机,取决于谁的浏览量和浏览器)),php,wordpress,Php,Wordpress,我尝试了多个广告插件,每刷新一页,他们都会将其计算为3次印象 你知道为什么会发生这种情况,或者如何解决它吗 目前正在使用的广告引擎插件,并已尝试简单的广告管理器。 使用图像 示例代码: 插件代码: 更新:添加了我所有的代码 谢谢 有一件事需要检查: 它是以不同的主题发生的吗?如果不是,插件的计数器挂接在哪个API钩子上 您的模板/主题很可能遵循非标准模式,导致给定的hooker在每次页面加载时被激活不止一次 如果问题是由您的主题触发的,我们将处于一个需要调试的棘手情况。插件API挂钩有点多,可以

我尝试了多个广告插件,每刷新一页,他们都会将其计算为3次印象

你知道为什么会发生这种情况,或者如何解决它吗

目前正在使用的广告引擎插件,并已尝试简单的广告管理器。 使用图像

示例代码:

插件代码:

更新:添加了我所有的代码

谢谢

有一件事需要检查:

它是以不同的主题发生的吗?如果不是,插件的计数器挂接在哪个API钩子上

您的模板/主题很可能遵循非标准模式,导致给定的hooker在每次页面加载时被激活不止一次

如果问题是由您的主题触发的,我们将处于一个需要调试的棘手情况。插件API挂钩有点多,可以在主题的许多部分触发,请看以下参考:

一些方法:

如果插件源代码不是太大,您可以查看它并查找钩子的使用情况,然后您可以找出事件重复发生的位置

将你的主题与功能主题进行比较,看看你是否在做一些反模式的工作。我将从页眉部分、侧边栏和页脚开始。重复次数3也是一个很好的提示

您是否在主题中重复给定代码3次? 您的post循环是否正好运行3次


理论上,问题代码可能在任何地方,但请注意将标题与功能主题的标题进行比较,它是主题中最关键的部分之一。

永远不要说出任何接近正常的东西


我不敢相信整个问题都是因为我的小部件区域被命名为“广告”…

这是什么意思?如果不是,计数器挂在哪个钩子上?状态:检查不同的模板确定我的主题,因为它在另一个模板中工作得很好..可能是什么?只是粘贴了我所有的代码,感谢您提供的任何帮助:在与其他一些远程测试后,似乎这个数字是随机的,但每个用户都一样。我的现在上升了4,没有任何变化。。另一个上升2,另一个上升3..这能告诉你什么吗?试试这个:一个接一个地拆下零件,看看它的表现如何,也许你能找出问题。
                    <!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
  <meta charset="utf-8">

  <!-- Use the .htaccess and remove these lines to avoid edge case issues.
       More info: h5bp.com/b/378 -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

  <!--Wordpress Template-->
  <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>  
  <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />  

  <?php wp_head(); ?>

  <meta name="description" content="Saint Petersburg SociaBulls">
  <meta name="author" content="Austin Piazza">

  <!-- Mobile viewport optimized: j.mp/bplateviewport -->
  <meta name="viewport" content="width=device-width,initial-scale=1">

  <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->

  <link rel="stylesheet" type="text/css" href="<?php bloginfo('wpurl'); ?>/wp-content/themes/sociabulls/js/jcar/skins/tango/skin.css" />

  <!-- CSS: implied media=all -->
  <!-- CSS concatenated and minified via ant build script-->
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen,projection" />  
  <!-- end CSS-->

  <!-- More ideas for your <head> here: h5bp.com/d/head-Tips -->

  <!-- All JavaScript at the bottom, except for Modernizr / Respond.
       Modernizr enables HTML5 elements & feature detects; Respond is a polyfill for min/max-width CSS3 Media Queries
       For optimal performance, use a custom Modernizr build: www.modernizr.com/download/ -->
  <script src="<?php bloginfo('wpurl'); ?>/wp-content/themes/sociabulls/js/libs/modernizr-2.0.6.min.js"></script>


  <!-- end scripts-->

  <script type="text/javascript">
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        // Configuration goes here
    });
});
</script>

  <link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'>
</head>

<body <?php body_class($class); ?>>

  <div class="wide" id="container">
    <header id="sticky" class="wide">
        <div class="center">
        <a href="#"><h1 id="logo" class="notext">St. Pete Sociabulls</h1></a>
        <ul id="nav">
            <?php wp_list_pages('title_li='); ?>
        </ul>
        </div>
    </header>

<div id="page">
<div id="top"><div id="city"></div></div>
<div id="main" role="main" class="wide">
    <div id="full">
        <div class="center">
            <div id="moveup">

                <div id="main-event">
                     <h2><?php the_title('');?></h2>
                     <?php if (have_posts()) : while (have_posts()) : the_post();?>
                     <div class="whole-post">

                         <div class="post-date">
                            <?php the_date( 'M d' ); ?>
                         </div>
                         <div class="entry">
                             <div class="entrytext">
                                  <?php the_content(); ?>
                             </div>
                         </div>
                     </div>
                   <?php endwhile; endif; ?>
                </div>

                <aside>

                    <?php if ( !function_exists('dynamic_sidebar')  
        || !dynamic_sidebar( 'rightsidebar' ) ) : ?> 
<?php endif; ?> 

<div id="ad-box">
                    <?php if ( !function_exists('dynamic_sidebar')  
        || !dynamic_sidebar( 'Ads' ) ) : ?> 
<?php endif; ?> 
</div>

                </aside>

             </div>
            </div>
        </div>
    </div>
  </div> 


<footer class="wide">
         <div id="seawall">
            <div class="center">
                <div id="sponsors">
                    <?php if ( !function_exists('dynamic_sidebar')  
        || !dynamic_sidebar( 'extra' ) ) : ?>
 <p>This is the deafult sidebar, add some widgets to change it.</p>  
<?php endif; ?> 

                </div>
                <div id="social-page">
                    <div class="fb-like-box" data-href="http://www.facebook.com/swingstampabay" data-width="350" data-height="170" data-show-faces="true" data-stream="false" data-header="false"></div>
                </div>
            </div>
         </div>
    </footer>
  </div> <!--! end of #container -->


  <!-- JavaScript at the bottom for fast page loading -->

  <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  <script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>
  <script type="text/javascript" src="<?php bloginfo('wpurl'); ?>/wp-content/themes/sociabulls/js/jcar/lib/jquery.jcarousel.js"></script>

  <!-- scripts concatenated and minified via ant build script-->
  <script defer src="js/plugins.js"></script>
  <script defer src="js/script.js"></script>

  <div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=270668269621466";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=265187160174054";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


  <!-- Change UA-XXXXX-X to be your site's ID -->
  <script>
    window._gaq = [['_setAccount','UAXXXXXXXX1'],['_trackPageview'],['_trackPageLoadTime']];
    Modernizr.load({
      load: ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js'
    });
  </script>


  <!-- Prompt IE 6 users to install Chrome Frame. Remove this if you want to support IE 6.
       chromium.org/developers/how-tos/chrome-frame-getting-started -->
  <!--[if lt IE 7 ]>
    <script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
    <script>window.attachEvent('onload',function(){CFInstall.check({mode:'overlay'})})</script>
  <![endif]-->

  <?php wp_footer(); ?>  

</body>
</html>