Skip to content

Instantly share code, notes, and snippets.

@MjHead
Last active July 28, 2022 10:55
Show Gist options
  • Save MjHead/46bc167762d684460200d4cf58606efc to your computer and use it in GitHub Desktop.
Save MjHead/46bc167762d684460200d4cf58606efc to your computer and use it in GitHub Desktop.
One more example of custom callbacks for Filter field output in JetEngine / Dynamic Field widget.
<?php
add_filter( 'jet-engine/listings/allowed-callbacks', 'jet_custom_callbacks' );
/**
* Add callback to list.
*/
function jet_custom_callbacks( $callbacks ) {
$callbacks['jet_team_name'] = __( 'Team Member Name', 'txt-domain' );
$callbacks['jet_team_photo'] = __( 'Team Member Photo', 'txt-domain' );
return $callbacks;
}
/**
* Callback function for name.
*/
function jet_team_name( $id ) {
return get_the_title( $id );
}
/**
* Callback function for photo.
*/
function jet_team_photo( $id ) {
return get_the_post_thumbnail( $id, 'thumbnail', array( 'alt' => get_the_title( $id ) ) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment