Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Counter Shortcode

WordPress plugin providing a [counter] shortcode to animate a number from 0 up to a target value.

The animation is triggered on scroll, when the counter enters the viewport (Intersection Observer) — ideal for highlighting key figures on a home page.

Installation

  1. Place counter-shortcode.php and counter.js into wp-content/plugins/counter-shortcode/.
  2. Activate "Counter Shortcode" from the WordPress Plugins menu.

Usage

Insert the shortcode into a page, a post or a widget:

[counter end="100"]
[counter start="0" end="500" speed="0.1"]

Parameters

Attribute Description Default
start Counter start value 0
end Target value to reach 100
speed Animation speed (the higher the value, the faster) 0.1

How it works

  • The script is only loaded on the front end.
  • The animation starts when 50% of the counter is visible on screen, then observation stops.
  • Smooth rendering via requestAnimationFrame.

Compatibility

WordPress · PHP 7.4+ · GPL2 license

Author

coding974.com

About

WordPress plugin — animated counter shortcode

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages