Viewing 2 replies - 1 through 2 (of 2 total)
  • You’ll want to go and edit the index.php page in your template directory. Position it near the bottom. This will count all visits to your blog – main page.

    If you place it in each blog entry, it will count every time an entry is loaded – If you have 10 entries viewable on your front page, it will count 10 times every time your front page is loaded. Not the effect you’re after, I am sure.

    The code is corrupted because the majority of the tags used are not legal code for the body of your posts.

    If you are using multiple templates or template switching – you can add this code to each template index.php file wherever you want it to appear in each template. Top, Bottom, left menu, pathway… etc.

    Thread Starter mgholden

    (@mgholden)

    Thanks Strixy,

    I inserted the code AFTER the PHP and it seems to work now. To make the Java counter work I now have the page code reading:

    <?php
    /* Short and sweet */
    define(‘WP_USE_THEMES’, true);
    require(‘./wp-blog-header.php’);
    ?>
    <!– #BeginLibraryItem “https://www.matthewholden.com.au/Statcounter.lbi&#8221; –>
    <!– Start of StatCounter Code –>
    <!– This code is for v1 of https://www.matthewholden.com.au –>
    <script type=”text/javascript” language=”javascript”>
    <!–
    var sc_project=0;
    var sc_partition=3;
    //–>
    </script>
    <script type=”text/javascript” language=”javascript” src=”https://www.statcounter.com/counter/frames.js”></script&gt;
    <noscript>
    <img src=”https://c4.statcounter.com/counter.php?sc_project=0&java=0&#8243; alt=”counter” border=”0″>
    </noscript>
    <!– End of StatCounter Code –>
    <!– #EndLibraryItem –>

    The above coding works.

    PS – love your tag line “What do you mean get a life? This IS my life!”

    Thanks again

    Matthew

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Insert Java Script Page Counter’ is closed to new replies.