WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Not Firefox compatible?

[Resolved] Not Firefox compatible?

  • I use the following code in my header.php to keep track of the posts visited by users, but somehow Firefox stores two ID’s on one page visit. The second ID is from the next page published. The last post published is the only page that gets me one ID, since there is no next post.

    It seems Firefox is loading the header.php twice? Is this a WordPress bug? Do you know what could be wrong?! I really appreciate all the help I can get.

    <?php
    global $wp_query;
    $post_id = $wp_query->post->ID;
    $cookietime = time()+3600*24*365;
    $lt = '|';
    if (isset($_COOKIE['tst'])) {
    	$viewedstring = $_COOKIE['tst'];
    	$viewedstring .= $post_id.$lt;
    	setcookie('tst', $viewedstring, $cookietime, '/', '.domain.com');
    }else{
    	$viewedstring = $post_id.$lt;
    	setcookie('tst', $viewedstring, $cookietime, '/', '.domain.com');
    }
    ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Not Firefox compatible?’ is closed to new replies.
Skip to toolbar