Wordpress Statpress Plugin Help

Discussion in 'WordPress' started by ken123, Sep 10, 2008.

  1. #1
    Is possible that I can display the total page views for my blog using Statpress? I know I can use %totalvisit%, as well as others, but not total page views. Has anybody done it? Thanks.
     
    ken123, Sep 10, 2008 IP
  2. zk5182

    zk5182 Active Member

    Messages:
    896
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    use the google analytics plugin
     
    zk5182, Sep 11, 2008 IP
  3. eastnee

    eastnee Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Edit the statpress.php in wp-statpress plugin directory.

    Go to line 1294, which display this code
    
    function iri_StatPress_Vars($body) {
       	global $wpdb;
    	$table_name = $wpdb->prefix . "statpress";
    	if(strpos(strtolower($body),"%visits%") !== FALSE) {
    		$qry = $wpdb->get_results("SELECT count(DISTINCT(ip)) as pageview FROM $table_name WHERE date = '".gmdate("Ymd",current_time('timestamp'))."' and spider='' and feed='';");
    		$body = str_replace("%visits%", $qry[0]->pageview, $body);
    	}
    
    Code (markup):

    Add this code:
    
    	if(strpos(strtolower($body),"%totalpageviews%") !== FALSE) {
    			$qry = $wpdb->get_results("SELECT count(id) as pageview FROM $table_name WHERE spider='' and feed='';");
    			$body = str_replace("%totalpageviews%", $qry[0]->pageview, $body);
    	}
    
    Code (markup):
    Then use %totalpageviews% as usual.
     
    eastnee, Nov 11, 2008 IP