• Resolved giovannihdgd

    (@giovannihdgd)


    Hello,
    I added the commands [whohit]Name-Page[/whohit] to all pages and posts but… how do I count the “Home”? That doesn’t count as a “page”…

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Lindeni Mahlalela

    (@mahlamusa)

    Hello @giovannihdgd

    I hope you are doing well today, you can achieve this by adding the following code snippet on your theme’s functions.php or by creating a new PHP file and upload it to your website in wp-content/mu-plugins, this is the advisable method so create a new file maybe call it ‘count-visits-on-home-page.php’ then paste the following code:

    /**
     * Count visits on the homepage
     */
    if ( is_home() && is_front_page() ) {
        who_hit_the_page( "Home" );
    }

    save it and upload it to your website using FTP in the following location:

    wp-content/mu-plugins/count-visits-on-home-page.php

    Once you have that in place, please test and see if it works. If it does not work properly then please try to change the if (…) condition so that you have only

    if (is_home()) {
    ...}

    OR

    if (is_front_page()){
    ...}

    I hope this helps but please let me know if you have any issues.

    Thanks

Viewing 1 replies (of 1 total)
  • The topic ‘How do I count the “Home” page?’ is closed to new replies.