This file contains 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 | |
/** | |
* Returns an array of image IDs stored in gllery meta field | |
* | |
* @param string $field_key Gallery field meta key | |
* @param int $post_id Post ID to get field from. If not set - will try to use current post. | |
* @return array | |
*/ | |
function my_get_jet_engine_gallery( $field_key = '', $post_id = null ) { |
This file contains 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 | |
/** | |
* Get fields for the given context and object | |
* Should be called on hook 'init' with priority 11 or later | |
*/ | |
// Fields for Post post type | |
$post_fields = jet_engine()->meta_boxes->get_fields_for_context( 'post_type', 'post' ); | |
// Fields for Product post type |
This file contains 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 | |
/** | |
* Update related item from form action/notification | |
* | |
* @param array $args [description] | |
* @return [type] [description] | |
*/ | |
function my_update_related_items( $args = array() ) { | |
$relation = ! empty( $args['relation'] ) ? $args['relation'] : false; |
This file contains 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 | |
/** | |
* Adds custom fields into the insert new related item popup. | |
* Hook name - jet-engine/relations/types/posts/create-fields - depends on type of created item, | |
* for CPT it will be - jet-engine/relations/types/posts/create-fields | |
* for terms - jet-engine/relations/types/terms/create-fields | |
* for users - jet-engine/relations/types/mix/create-fields/users | |
* | |
* just replace 'jobs' in the example with your actual post type/taxonomy slug |
This file contains 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_action( 'wp_footer', function() { | |
?> | |
<script type="text/javascript"> | |
document.addEventListener( 'bricks/ajax/popup/loaded', (event) => { | |
window.JetPlugins.init( jQuery( event.detail.popupElement ) ) | |
}); | |
</script> | |
<?php |
This file contains 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-form-builder/form-handler/form-data', function( $request ) { | |
if ( isset( $request['field_name_to_sanitize'] ) ) { | |
$request['field_name_to_sanitize'] = wp_strip_all_tags( $request['field_name_to_sanitize'] ); | |
} | |
return $request; | |
} ); |
This file contains 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 | |
/** | |
* JetEngine CCT-related API functions to use in theme or plugin | |
* | |
* Theme usage - include get_theme_file_path( 'jet-engine-cct-api.php' ); | |
* Plugin usage - include PLUGIN_PATH . 'path-to-file-inside-plugin/jet-engine-cct-api.php'; | |
*/ | |
/** |
This file contains 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 | |
/** | |
* Method 1 | |
* Can be used for: Any storage type | |
* | |
* page-slug - replace this with your Option Page slug | |
* option-name - replace this with your option Name/ID | |
*/ | |
$value = jet_engine()->listings->data->get_option( 'page-slug::option-name' ); |
This file contains 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_action( 'wp_ajax_jet_ajax_search', 'my_get_search_results', 0 ); | |
add_action( 'wp_ajax_nopriv_jet_ajax_search', 'my_get_search_results', 0 ); | |
function my_get_search_results() { | |
$request = $_GET['data']; | |
$search_query = urldecode( $request['value'] ); | |
$per_page = ( int ) $request['limit_query_in_result_area']; |
This file contains 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_action( 'jet-form-builder/custom-action/iterate-submissions', function( $request, $action_handler ) { | |
$uid = get_option( '_my_uid', false ); | |
if ( ! $uid ) { | |
$uid = 1; | |
} | |
jet_fb_context()->update_request( $uid, '_uid' ); | |
$uid++; |
NewerOlder