Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Last active February 12, 2026 17:12
Show Gist options
  • Select an option

  • Save Crocoblock/5f588a0d8bbb5ebe73633cfe5eedd5df to your computer and use it in GitHub Desktop.

Select an option

Save Crocoblock/5f588a0d8bbb5ebe73633cfe5eedd5df to your computer and use it in GitHub Desktop.
Dynamic Repeater filter callback - format number
<?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