Last active
February 12, 2026 17:12
-
-
Save Crocoblock/5f588a0d8bbb5ebe73633cfe5eedd5df to your computer and use it in GitHub Desktop.
Dynamic Repeater filter callback - format number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class JEC_Repeater_Format_Number { | |
| public function __construct() { | |
| add_filter( | |
| 'jet-engine/listings/filters-list', | |
| array( $this, 'add_callback' ) | |
| ); | |
| } | |
| public function add_callback( $callbacks ) { | |
| $callbacks['format_number'] = array( | |
| 'cb' => array( $this, 'callback' ), | |
| 'args' => '', | |
| ); | |
| return $callbacks; | |
| } | |
| public function callback( $value, $arg = 0 ) { | |
| $value = floatval( $value ); | |
| $arg = intval( $arg ); | |
| return number_format( $value, $arg ); | |
| } | |
| } | |
| new JEC_Repeater_Format_Number(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment