WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a counter to put in my theme (using php) or widget to show homepage view counts I've tried "Cystats" but i couldn't get 'only' homepage hits by it how can I do this ?

(there is a idea to show how many times website has been opened -sessions counts- for example- but i couldn't find any counter to do that , it's ok to find a way to show that instead of homepage counts)

share|improve this question
up vote 1 down vote accepted

Add the counter (PHP or otherwise) to the template file for the home page. This will be either home.php or index.php depending on how you have things set up.

If you want to instead add it in the footer, enclose the code inside a conditional tag to detect whether or not you're on the home page:

if( is_front_page() ) {
    // ... put your tracking code here.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.