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_shortcode( 'post_terms', function( $atts = array() ) { | |
$atts = shortcode_atts( array( | |
'tax' => '', | |
'tax_2' => '', | |
'tax_3' => '', | |
), $atts, 'post_terms' ); |
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 | |
/** | |
This function should be called on the 'init' hook with priority 11 or later, | |
if not custom content type instances will not be registered yet | |
Available operators: | |
= | |
!= |
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 | |
/* | |
form_submissions - replace this with your actual CCT slug | |
cct_single_post_id - replace this with your actual field name | |
*/ | |
add_filter( 'jet-engine/custom-content-types/admin-columns', function( $columns, $factory ) { | |
if ( 'form_submissions' === $factory->get_arg( 'slug' ) && isset( $columns['cct_single_post_id'] ) ) { | |
$columns['cct_single_post_id']['_cb'] = 'my_get_edit_post_link'; | |
} |
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_action( 'edit_user_profile', 'my_user_likes' ); | |
add_action( 'show_user_profile', 'my_user_likes' ); | |
function my_user_likes( $user ) { | |
// user-meta-store you need to replace with your actual Data Store slug | |
$liked = get_user_meta( $user->ID, 'je_data_store_user-meta-store', true ); | |
echo '<h2>User Likes</h2>'; |
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 | |
/** | |
* 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 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_shortcode( 'my_jet_form', 'my_jet_form_shortcode' ); | |
function my_jet_form_shortcode( $atts = array() ) { | |
$atts = shortcode_atts( array( | |
'id' => false, | |
'submit_type' => 'reload', // or ajax | |
'required_mark' => '*', |
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/dynamic-functions/final-query', function( $query, $function_data ) { | |
$data_source = ! empty( $function_data['data_source'] ) ? $function_data['data_source'] : false; | |
$source = ! empty( $data_source['source'] ) ? $data_source['source'] : 'post_meta'; | |
$field_name = ! empty( $data['field_name'] ) ? $data['field_name'] : false; | |
if ( 'meta_value' === $source ) { | |
$query = preg_replace( '/;$/', 'AND `meta_value` != \'\';', $query ); |
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 | |
/** | |
* Callback will be applied for each field of each CCT item in the REST API response | |
* cct_slug - change this with your actual CCT slug | |
* _cct_field_name - change this with your actual field name | |
*/ | |
add_filter( 'jet-engine/custom-content-types/rest-api/filters/cct_slug', function( $filters ) { | |
$filters['_cct_field_name'] = 'my_cct_column_filter_callback'; | |
return $filters; | |
} ); |
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 | |
/** | |
* 'api-request' - is a customm hook name | |
*/ | |
add_action( 'jet-form-builder/custom-action/api-request', function( $request, $action_handler ) { | |
$post_id = ! empty( $request['inserted_post_id'] ) ? $request['inserted_post_id'] : false; | |
if ( ! $post_id ) { | |
return; |
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 | |
/** | |
* 1. Add this code into the end of functions.php of your active theme without opening PHP tag; | |
* 2. Replace strings, metioned in the comments below, with your actual data. | |
*/ | |
add_filter( 'jet-engine/data-stores/store-post-id', function( $post_id, $store ) { | |
/** | |
* Replace 'cookies-store' with your actual Data Store slug | |
*/ |