Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
how to show number of views for each post/page in wordpress?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ovivankenobi  
View profile  
 More options Jan 31 2010, 7:28 am
From: ovivankenobi <ovivanken...@gmail.com>
Date: Sun, 31 Jan 2010 04:28:47 -0800 (PST)
Local: Sun, Jan 31 2010 7:28 am
Subject: how to show number of views for each post/page in wordpress?
After reading hte wiki and finding the api page, I guess I need to use
this function: fs_api_get_hit_count but I can't seem to get it right.

I'd like to show something like: viewed: XXX jsut show the total
number of views for each page and post.

can someone review this code for me please?

<?php
if (defined('FS_API'))
{
    echo "Number of times this page was viewed: ". fs_api_get_hit_count
(,true,the_permalink(););

}

?>

the above code doesn't work for me :-( I admit I suck at php so pelase
help me out here.
Also I do not know, what the first 2 parameters represent: the first
one was 100 restricting the number of views to the last 100 days - can
I leave it empty to show data from all times?

What is the 2nd one? true? what does it influence?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Omry Yadan  
View profile  
 More options Jan 31 2010, 8:56 am
From: Omry Yadan <o...@yadan.net>
Date: Sun, 31 Jan 2010 15:56:05 +0200
Local: Sun, Jan 31 2010 8:56 am
Subject: Re: [fs-users] how to show number of views for each post/page in wordpress?
the example was a bit outdated.
you should use  fs_api_get_page_views, which is documented here :
http://firestats.cc/wiki/API

/*
     Returns the number of pages displayed in the specified time period.
     days_ago is an optional parameter which specifies how many days ago to start counting.
     if days_ago is not specified, the count will begin when you installed FireStats.
     site_id : see comment at the start of the file
     url: see comment at the start of the file
*/
functionfs_api_get_page_views($days_ago=NULL,$site_id=true,$url=null)

if you don't want to specify days_ago, pass NULL instead, like:

     echo "Number of times this page was viewed: ". fs_api_get_hit_count(NULL,true,the_permalink());

note that you had an extra ; after the_permalink().

the site id parameter (second true in your call) is documented at the page.
you probably want to use true here.

On 01/31/2010 02:28 PM, ovivankenobi wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ovivankenobi  
View profile  
 More options Jan 31 2010, 4:28 pm
From: ovivankenobi <ovivanken...@gmail.com>
Date: Sun, 31 Jan 2010 13:28:39 -0800 (PST)
Local: Sun, Jan 31 2010 4:28 pm
Subject: Re: how to show number of views for each post/page in wordpress?
thanks.

almost there. I tried this:

<?php
if (defined('FS_API'))
{
echo fs_api_get_page_views(NULL,1,the_permalink())." vizualizari";

}

?>

the out put is this:

http://zice.ro/informatii/ce-fel-de-articole-si-tutoriale-va-doriti-d...
vizualizari

It basically prints out the current permalink followed by the number
of hits.
What am I doing wrong here? It shouldn't print out the permalink just
use it to show only the hits for the current page/post.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "how to show number of views for each post/page in wordpress?" by Omry Yadan
Omry Yadan  
View profile  
 More options Feb 2 2010, 1:37 am
From: Omry Yadan <o...@yadan.net>
Date: Tue, 02 Feb 2010 08:37:12 +0200
Local: Tues, Feb 2 2010 1:37 am
Subject: Re: [fs-users] Re: how to show number of views for each post/page in wordpress?
I am guessing that the_permalink() is doing the printing.
try to use get_permalink($post->ID) instead,
Assuming you call it in the context of a post (if not ask in WordPress
forums).


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "how to show number of views for each post/page in wordpress?" by ovivankenobi
ovivankenobi  
View profile  
 More options Feb 2 2010, 9:27 am
From: ovivankenobi <ovivanken...@gmail.com>
Date: Tue, 2 Feb 2010 06:27:56 -0800 (PST)
Local: Tues, Feb 2 2010 9:27 am
Subject: Re: how to show number of views for each post/page in wordpress?
thx, works perfectly

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »