Statpress total pageviews sidebar (3 posts)

  1. mudfooted
    Posted 6 years ago #

    I wanted to show the total number of pageviews in the statpress widget. However, stapress does not have that option. Therefore I found my own solution which I wanted to share here so that other people might benefit.

    1. Go to plugins > statpress and click edit
    2. At the bottom, find:
    ` if(strpos(strtolower($body),"%thistotalvisits%") !== FALSE) {
    $qry = $wpdb->get_results("SELECT count(DISTINCT(ip)) as pageview FROM $table_name WHERE spider='' and feed='' AND urlrequested='".iri_StatPress_URL()."';");
    $body = str_replace("%thistotalvisits%", $qry[0]->pageview, $body);
    3. Immediately below this, add the following:
    ` if(strpos(strtolower($body),"%thistotalpages%") !== FALSE)
    $qry = $wpdb->get_results("SELECT count(ip) as pageview FROM $table_name WHERE spider='' and feed='';");
    $body = str_replace("%thistotalpages%", $qry[0]->pageview, $body);
    4. Save
    5. Go to statpress widget and type "%thistotalpages% in the widget body
    6. Done!

    Good luck!

  2. opus20x
    Posted 6 years ago #

    Great, Thank You!!

  3. afdownload
    Posted 6 years ago #

    thanks man very nice

Topic Closed

This topic has been closed to new replies.

About this Topic