WordPress.org

Ready to get started?Download WordPress

Forums

bbclone w/ WordPress 2 (5 posts)

  1. muzicman82
    Member
    Posted 7 years ago #

    Hello folks. I'm not new to bbclone by any means, but this is my first try at putting it in a WordPress site.

    I've read many forum and blog posts that suggest adding code to each template file, such as index.php, archive.php, page.php, single.php, etc.

    I've also read suggestions about adding a single piece of code to wp-blog-header.php.

    Both of the above suggestions work, but it seems that both incorrectly track visits. For example, if I add code to the wp-blog-header.php file, it seems to add 2-4 hits for every single visit to an archive page. Now, that's not accurate is it?

    I'm trying to understand why I can't add bbclone code to my header.php file and be done. There, it doesn't track at all. However, this seems to be the one template file that is used on every page, and only once.

    I'd like a SINGLE place to add this code.

    The code I'm using is this:

    <?php
    if (is_home() == true) {
    	$pagetitle = "Home";
    	}
    else {
    	$pagetitle = wp_title('', false);
    	}
    
    define("_BBC_PAGE_NAME", $pagetitle);
    define("_BBCLONE_DIR", "bbclone/");
    define("COUNTER", _BBCLONE_DIR."mark_page.php");
    if (is_readable(COUNTER)) { include_once(COUNTER); }
    else { echo "Counter is broken."; }
    
    ?>

    Thanks.

  2. txmom
    Member
    Posted 6 years ago #

    Thanks for the code. I'd moved my blog to a new host, and needed to install a stats program.

    I found this post while searching for how best to edit code, it works, thanks. As to where we put the code, we added it to template-loader.php in the wp-includes folder.

    So I didn't forget how, had help, I wrote down the steps on a blog post adding bbclone to wordpress.

  3. jamessnell
    Member
    Posted 6 years ago #

    Sadly your link is dead and I'd love to have that content! Ohh why cruel world why!?

  4. jamessnell
    Member
    Posted 6 years ago #

    I've been grinding on this for awhile now.. Sadly, I can't quite get bbclone to work. I created a test page and that works fine..

    I've confirmed that bbclone is being called using some echo statements. However it seems to quit prematurely in the bbclone code:

    // Don't process anything unless we are told to do so
      if (!defined("_OK")) {
        if (empty($BBC_DEBUG)) return ignore_user_abort(0);
        else exit($i);
      }

    I'm really not sure what is going on here, but it's sort of driving me totally nuts! :)

  5. jamessnell
    Member
    Posted 6 years ago #

    Okay, I've got it.. Thanks to this site: http://www.iltchev.com/?page_id=11

    Just in case that site gets nuked or something here's the info I used:

    Modify wp-blog-header.php:
    
    ...
    gzip_compression();
    
    //-- Insert BBclone Code from here @
    define("_BBC_PAGE_NAME", get_bloginfo("name") . wp_title("/", false));
    define("_BBCLONE_DIR", "/full/path/to/bbclone/");
    define("COUNTER", _BBCLONE_DIR."mark_page.php");
    if (is_readable(COUNTER)) include_once(COUNTER);
    //-- @ to Here
    
    require_once(ABSPATH . WPINC . '/template-loader.php');
    
    endif;

    my wp-blog-header.php didn't have that gzip line, I just inserted the bbclone call right before the template-loader and it's working fine. I'm running this on WP 2.5 and seems good. Yay!

Topic Closed

This topic has been closed to new replies.

About this Topic