Last active
July 28, 2022 10:55
-
-
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.
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 | |
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