Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Last active November 18, 2025 08:54
Show Gist options
  • Select an option

  • Save Crocoblock/788f1d736c0625cc4eed63c12d84a6e2 to your computer and use it in GitHub Desktop.

Select an option

Save Crocoblock/788f1d736c0625cc4eed63c12d84a6e2 to your computer and use it in GitHub Desktop.
get label by glossary
<?php
add_filter( 'jet-form-builder/content-filters', function( $filters ) {
class Get_Labels_By_Glossary extends \Jet_Form_Builder\Classes\Filters\Base_Filter {
public function get_id(): string {
return 'get_label_by_glossary';
}
public function callback_args(): array {
return array( ', ' );
}
public function apply_macros( $value, ...$args ): string {
list( $glossary ) = $args;
if ( ! function_exists( 'jet_engine' ) || ! $glossary ) {
return $value;
}
return jet_engine_label_by_glossary( $value, $glossary );
}
}
array_unshift( $filters, ( new Get_Labels_By_Glossary() ) );
return $filters;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment