CyStats Template Functions / Template Tags

I used to use the WordPress plugin Counterize II to keep track of my blog’s statistics, but then I felt that I had to switch into something else. I looked for another feature-rich stats plugin but one that is faster and that will take up less database space. After trying different plugins, I chose to stick with CyStats.

The only thing I needed but didn’t get (right away) from CyStats is the code to insert into my themes in order to call functions to return values like the total number of hits, total number of comments, total number of posts, and such. Maybe there’s a web page lying around in the Internet and I simply did not search thoroughly that I wasn’t able to find it. And since I didn’t find it, I’m making my own list of template tags (template functions) here, hoping that it would help other users.

By the way, I got all these from the template-functions.php which is inside the /includes folder of the plugin. I’m putting a list here just to make our task easier. 😀

CyStats template tags/functions:

  • Show number of blog posts
    » Returns an integer
  • Show number of approved comments
    » Returns an integer
  • Show number of authors
    » Returns an integer
  • Show number of published pages
    » Returns an integer
  • Show number of links
    » Returns an integer
  • Show number of categories
    » Returns an integer
  • Show number of days since the first blog post
    » Returns an integer
  • Show the date when the first blog entry was posted
    » Returns a string
  • Show number of blog users in the database
    » Returns an integer
  • Show the names of top commenters
    » Returns strings
  • Show number of feed readers today
    » Returns an integer
  • Show the number of users online
    » Returns an integer
  • Show the recent blog posts
    » Returns an array of strings
  • Show the most commented blog posts
    » Returns an array of strings
  • Show the most visited blog posts
    » Returns an array of strings
  • Show post visits
    » Returns an array
  • Show recent comments
    » Returns array of strings
  • Show total number of visits
    » Returns an integer
  • Show total number of hits
    » Returns an integer
  • Show average number of posts per day
    » Returns an integer
  • Show average number of comments per day
    » Returns an integer
  • Show the count of search engine referers
    » Returns an integer

Function Parameters:

  • The boolean parameter $showmode echoes value when set to TRUE, while returns value when set to FALSE
  • The integer parameter $topcount should be replaced with the number of (commenters) to get
  • The string parameter $pre='' determines the string to set before each list item, e.g. $pre='<li>'
  • The string parameter $pos='' determines the string to set after each list item, e.g. $pos='</li>'
  • The integer parameter $limit should be replaced with the number of (posts) to get
  • The integer parameter $id in the function cystats_getPostVisitsByID(); should replaced with the ID number of a post
  • The string parameter $mode should be replaced with one of the following values: today, yesterday, week, month, year, or all.

Please note that not all functions were tested, and that the listed items are subject to error. Feel free to comment on this post if you notice any. 🙂

-->

Related Posts:

Posts that may be related to "CyStats Template Functions / Template Tags":

Catzie

A Filipino programmer with a variety of interests such as baking, singing, making up silly song/rap lyrics, K-pop, drawing, creating unique dessert flavors, obsessing about finding out how some things works, board games, anime, video games, and forgetting things that usually go in her long list of interests. Running small-time online dessert shops Cookies PH and Catzie's Cakery.

Leave a Reply

Your email address will not be published. Required fields are marked *