Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.