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.
}
Related Posts:
- Create custom page templates with plugins?
- Consuming an external API in WordPress?
- Is there a WordPress plugin that registers a plugin file as a custom page template?
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- Is it possible to stop selected plugins from loading on certain template pages?
- Ways to have multiple front-page.php templates that can be swapped out?
- How to track hits of a single media file?
- How can I have two different urls for the same page that load two different templates?
- Page Templates from plugin not working after upgrading WP to 4.7 or upper version
- Custom Taxonomy in plugin and template
- Use touch_time() on front-end form via plugin
- how to redirect to my template
- Template for custom post type shows all posts instead of just one
- Custom url structure for custom template
- Best Apache Log Analyzer Plugin? [closed]
- How do I add a template to a theme using a plugin?
- Creating a wordpress plugin where users can override templates
- Get image URL from media library in input
- Plugin shortcode won’t work on a custom template file [closed]
- How to enqueue a theme style-sheet to my admin settings page?
- How to get the “stats” plugin that comes with a .wordpress.com blog?
- How to Include a Loop Template File in a Plugin
- How to get the HTML until ?
- First WordPress Plugin – Stat Issues
- Should I fetch the data managed by a plugin by using its APIs or WordPress APIs?
- List Category Posts rewrite necessitates rewrite of customised templates
- WordPress comments not appearing in blog posts, likely because of Redux template. Could I fix this with a plugin that adds a comment form as a block? [closed]
- Plugin-generated pages use Not Found or Pages Archive templates?
- How to display (plugin?) output on a single page (not a widget, probably not a short code) – template, plugin, combination?
- Facebook Messager Plugin
- Advanced Custom Field DatePicker [closed]
- Use of Templates in a Plugin
- Add comments for template variables
- Render custom php template into string
- Perform internal redirect in WordPress?
- How WordPress is able to change locale without using setlocale
- Is there any hook for theme activation ? or something similar?
- How to use get_template part in the plugin?
- changing posts layout in ultimate member profile plugin
- How can I use a file in my plugin as a replacement for single.php on custom-post-type query?
- Best practice for including plugin output in a template without using shortcode?
- Timber – Twig post.content returns null can’t create ACF Gutenberg blocks
- Add estimated value for a post according to the number of words
- Where to find the code used to render a page that has a shortcode and a template defined?
- How do I override plugin templates and stylesheets?
- Is it possible to remove subscription box from Jetpack stats page? [closed]
- Default taxonomy template in plugin, override in theme
- WordPress stats: OWA plugin overhead in the future
- How to do database for download stats?
- Plugin Admin Menu Boiler Plate
- How to use template inside plugin shortcode with variables for big HTML code
- Pagination shows Same posts
- Should meta boxes for specific pages be save in their own plugins?
- Call a function for social sharing
- Ajax Call in page theme not working?
- reCAPTCHA on page template without plugin
- Woocommerce – Change Variable Product Add to Cart to behave like external product using Custom Field (link) [closed]
- Prevent plug-in scripts on a specific template?
- Multiple Post Thumbnails Plugin – Need help with code
- Wp-minify doesn’t seem to minify my JS code
- How to call php file in theme directory from plugin
- use EDD Content Restriction for restricting php in template
- WoCommerce Cart is not showing pricing
- Enqueue css to a third-party plugin template
- the_posts_pagination() not working if I add wp_head() to header.php
- Mobile Menu and Mobile Sidebar missing
- How to check if short code is present in template?
- WordPress hierarchy clarification, does post_type_archive take precedence over taxonomy-term archive?
- What are the disadvantages of using template_redirect for restrictions
- How to access Post Archive created by Elementor?
- How to prevent redoing get_posts queries and make results available to other scripts?
- Call function with button and return response
- Change Jobs for WordPress templates
- how to do Thematic like this website using wordpress?
- Customize plugin templates
- WordPress arrows dissapeared strange signs
- Template conflict with WC Payment Method
- Using WordPress to create a simple web app (SaaS) [closed]
- Why is WP template_include overwritting all templates rather than specified page?
- How to add HTML to a template only when user is logged out/ not registered
- Adding a custom page template to a plugin generated page
- History of page, interval of years
- How to echo a plugin’s function into a template?
- How to add dynamic content to posts page, archive, taxonomies, search, author, etc?
- WP plugin calls for custom pages
- custom template only for content
- Convert HTML5/CSS3 site to WordPress Theme (need a lot of plugins) or just use the API?
- Is there any simple wordpress search template that works with existing searchforms?
- WordPress multisite haml templates
- How to make plugin work in each template in wordpress
- [Custom field template plugin] Upload limited to 20 inputs file
- WordPress show different custom post type
- Display HTML5 jQuery Audio Player On Front Page
- Template library for WordPress [closed]
- Divi Template A Few Questions
- My Blog page ( posts page ) theme isn’t changing with the new theme [closed]
- How to provide page_template path in custom plugin using WordPress
- Newspaper theme, custom query vars, & custom rewrite rules
- Load a custom post type template.html from a plugin
- Is there potential plugin incompatibility if theme has no header.php and footer.php?