WordPress Plugins > WP-PostViews

WP-Postviews counts double

(1/2) > >>

timbim:
Hi everybody,
I have a little problem with WP-Postviews:
It counts double for every following post. For example I have a blogpost with a lot of views. THe following blogpost ALWAYS also has a lot of views. SO I thing WP-Postviews counts the views for every blogposts and also ads this views to the following blogpost.
Can anybody help me and tell me how to fix it?
Thanks a lot!
Tim

aSKer:
Did you check your theme to make sure it doesn't include twice:

--- Code: ---<?php wp_head(); ?>
--- End code ---
in your header?

or maybe it includes twice:

--- Code: ---<?php wp_footer(); ?>
--- End code ---
in your footer?

timbim:
Hello aSKer,

thanks for help. I´m not a WP-Pro, so I´m not sure about it.

I have
<?php get_header(); ?>
and
<?php get_footer(); ?>
bothe one time in single.php and index.php

And additionally I have <?php get_header(); ?> in header.php and <?php get_footer(); ?> in footer.php.

Is that coorect?

Best regards, Tim

aSKer:
What you need is:

- In the top of index.php and single.php:

--- Code: ---<?php get_header(); ?>
--- End code ---

- In the bottom of index.php and single.php:

--- Code: ---<?php get_footer(); ?>
--- End code ---

- Somewhere in header.php (between <head> and </head>):

--- Code: ---<?php wp_head(); ?>
--- End code ---

- Somewhere in footer.php:

--- Code: ---<?php wp_footer(); ?>
--- End code ---



You should absolutely NOT have:

<?php get_header(); ?> in header.php
and
<?php get_footer(); ?> in footer.php

timbim:
Hey aSKer,

sorry, that´s exactly how I have it (I wrote it down incorretly before):

- In the top of index.php and single.php:
Code:

<?php get_header(); ?>

- In the bottom of index.php and single.php:
Code:

<?php get_footer(); ?>


- Somewhere in header.php (between <head> and </head>):
Code:

<?php wp_head(); ?>

- Somewhere in footer.php:
Code:

<?php wp_footer(); ?>

But wp-postviews does not count correcty. Any more ideas?!

Thanks,
Tim

---> Single.php:

<?php get_header(); ?>

<!--include sidebar-->
<?php include(TEMPLATEPATH."/l_sidebar.php");?>
<!--include sidebar-->
<?php include(TEMPLATEPATH."/r_sidebar.php");?>

<div id="content">
<!--single.php-->
   
<!--loop-->         
  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

           <!--navigation-->
<p><?php previous_post_link('&laquo; %link  |') ?>  <a href="<?php bloginfo('url'); ?>">Home</a>  <?php next_post_link('|  %link &raquo;') ?></p>
   
      <!--post title-->
         <h2 id="post-<?php the_ID(); ?>"><?php the_title(); ?></h2>
      <p><b>Von <?php the_author(); ?></b> | <?php the_time('j.F Y'); ?></p>
<div class="postspace2">
   </div>         
<!--content with more link-->
         <?php the_content('<p class="serif">Weiterlesen &raquo;</p>'); ?>
   
                       <!--for paginate posts-->
         <?php link_pages('<p><strong>Seiten:</strong> ', '</p>', 'number'); ?>
         
<center>         
<script type="text/javascript"><!--
amazon_ad_tag = "ll_blog_content-21"; amazon_ad_width = "300"; amazon_ad_height = "250"; amazon_ad_link_target = "new"; amazon_color_border = "42533F"; amazon_ad_categories = "abcd";//--></script>
<script type="text/javascript" src="http://www.assoc-amazon.de/s/ads.js"></script>
</center>   
<br><br>

         <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
         
<p><b>...</b> <?php if(function_exists('the_views')) { the_views(); } ?> <?php comments_popup_link('Kein Kommentar &#187;', '1 Kommentar &#187;', '% Kommentare &#187;'); ?> | Kategorie <?php the_category(', ') ?> | Tags <?php the_tags(' ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> Trackback: URL/trackback</p>

<?php if(function_exists('wp_email')) { email_link(); } ?>
            
<div class="postspace">
   </div>

            <!--all options over and out-->
   
      
   <!--include comments template-->
   <?php comments_template(); ?>
   
        <!--do not delete-->
   <?php endwhile; else: ?>
   
   Leider nichts Passendes gefunden!

<!--do not delete-->
<?php endif; ?>

<br><br>
<div class="sterms">
<h4>Top Suchbegriffe:</h4>
<ul>
<?php mystp_get_terms(10); ?>
</ul>
</div>
   
<!--single.php end-->
</div>


<!--include footer-->
<?php get_footer(); ?>

##############################################

---> INDEX.php

<?php get_header(); ?>

<!--include sidebar-->
<?php include(TEMPLATEPATH."/l_sidebar.php");?>
<!--include sidebar-->
<?php include(TEMPLATEPATH."/r_sidebar.php");?>

<div id="content">

   <!--index.php-->
        <!--the loop-->
   <?php if (have_posts()) : ?>
      <!--the loop-->
      <?php while (have_posts()) : the_post(); ?>
            
         <!--post title as a link-->
            <h2 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanenter Link zu <?php the_title(); ?>"><?php the_title(); ?></a></h2>
   <p><b>Von <?php the_author(); ?></b> | <?php the_time('j.F Y'); ?> </p>
      <div class="postspace2">
   </div>   
            <!--post text with the read more link-->
               <?php the_content('Weiterlesen &raquo;'); ?>
            <!--show categories, edit link ,comments-->
      
      <?php if(function_exists('the_ratings')) { the_ratings(); } ?>
      
            <p><b>...</b> <?php if(function_exists('the_views')) { the_views(); } ?> | <?php comments_popup_link('Kein Kommentar &#187;', '1 Kommentar &#187;', '% Kommentare &#187;'); ?> | Kategorie <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> </p>
   <div class="postspace">
   </div>      
           <!--end of one post-->
      <?php endwhile; ?>

      <!--navigation-->
                <?php next_posts_link('&laquo; Vorangehende Artikel') ?>
      <?php previous_posts_link('Nachfolgende Artikel &raquo;') ?>
      
   <!--do not delete-->
   <?php else : ?>

      Nichts gefunden!
      Was Sie suchen gibt es hier leider nicht.
      <?php include (TEMPLATEPATH . "/searchform.php"); ?>
        <!--do not delete-->
   <?php endif; ?>

<!--index.php end-->
</div>
   

<!--include footer-->
<?php get_footer(); ?>

##################################################

-----> footer.php


<div id="footer">

<!--footer.php-->
   
      <strong><?php bloginfo('name'); ?></strong> wird geschrieben mit <a href="http://wordpress.org/">WordPress</a>.<br>
      Alle Buchkritiken, Rezensionen, Buchbesprechungen der Leselupe.
      <br><br>
      <a href="http://www.leselupe.de/lw/service.php?action=impressum">Impressum</a>
   
                 <!--necessary-->
      <?php wp_footer(); ?>
      </div>
</div>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-274772-2");
pageTracker._trackPageview();
} catch(err) {}</script>

</body>
</html>

########################################

---> header.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//DE_de" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' |'; } ?> <?php bloginfo('name'); ?></title>

<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" /> <!-- leave this for stats -->

<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />


<!--we need this for plugins-->
<?php wp_head(); ?>
</head>
<body>
<div id="container">


<div align="center"><img src="<?php bloginfo('template_url'); ?>/images/photo1.jpg" alt="<?php bloginfo('name'); ?>" /></div>




<div id="menu">
   <ul>
      <li class="page_item"><a href="<?php echo get_settings('home'); ?>">Home</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.leselupe.de/blog/feed/"><img src="http://angelausruestung.com/wp-content/themes/rockinnewspaper-3col-1_ger/images/rss.png" width="16" height="16" border="0">
 RSS Feed </a>

   </ul>
   </div>


<!--header.php end-->

#########################

Navigation

[0] Message Index

[#] Next page

Go to full version