WordPress.org

Ready to get started?Download WordPress

Forums

Statpress total pageviews sidebar (3 posts)

  1. mudfooted
    Member
    Posted 4 years ago #

    Hi
    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
    Member
    Posted 4 years ago #

    Great, Thank You!!

  3. afdownload
    Member
    Posted 3 years ago #

    thanks man very nice

Topic Closed

This topic has been closed to new replies.

About this Topic