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 action Hook before Insert/update CCT, set 'validate-cct' as hook name - https://i.imgur.com/48wcTA4.png | |
* 2. Replace 'tournaments' with your actual CCT slug | |
* 3. Replace 'name' with actual parameters to find similar items | |
*/ | |
add_filter( 'jet-form-builder/custom-filter/validate-cct', function( $result, $request, $action ) { | |
$cct_slug = 'tournaments'; | |
$cct = \Jet_Engine\Modules\Custom_Content_Types\Module::instance()->manager->get_content_types( $cct_slug ); |
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 | |
namespace Jet_Engine\Query_Builder\Queries; | |
// put this file into jet-engine\includes\components\query-builder\queries\ and replace initial file | |
// this comment is actual until 3.0.3 version | |
abstract class Base_Query { | |
public $id = false; | |
public $name = false; |
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 | |
// Base arg class. all args must extend it | |
abstract class Base_Arg { | |
// returns main arg | |
abstract public function get_arg(); | |
// returns main arg label for UI control | |
abstract public function get_name(); | |
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( 'init', function() { | |
// Check if need to do an API request | |
if ( empty( $_GET['test_api_request'] ) ) { | |
return; | |
} | |
// get remote data |
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/ajax-listing-url', function( $url ) { | |
return esc_url( admin_url( 'admin-ajax.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 | |
/** | |
* 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 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 | |
/** | |
* 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 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 | |
/** | |
* 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 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/listing/grid/posts-query-args', function( $args, $widget, $settings ) { | |
if ( 'custom-query' === $settings['_css_classes'] ) { | |
$args['meta_query'][] = array( | |
'relation' => 'OR', | |
0 => array( | |
'key' => 'submission-date', |
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 | |
/** | |
* Note! Always include mcros file only on 'jet-engine/register-macros' hook - before base class is not avaialable, | |
* after - all macros already registered and you can't insert a new one. | |
*/ | |
add_action( 'jet-engine/register-macros', function() { | |
require_once get_theme_file_path( 'macros.php' ); | |
new My_JE_Macros(); | |
} ); |