WordPress.org

Support

Support » Plugins and Hacks » Statpress total pageviews sidebar

Statpress total pageviews sidebar

  • 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!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Statpress total pageviews sidebar’ is closed to new replies.
Skip to toolbar