0

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)

1

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.
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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