Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Created October 28, 2022 10:07
Show Gist options
  • Save Crocoblock/276514e4c2db54f832d394e57cd6ab3b to your computer and use it in GitHub Desktop.
Save Crocoblock/276514e4c2db54f832d394e57cd6ab3b to your computer and use it in GitHub Desktop.
JetEngine Query CCT items from DB
<?php
//get_content_types() should be called on init with priority 12 or higher, or at any action later than init (there are no registered CCTs before that action)
$result = array();
$content_type = \Jet_Engine\Modules\Custom_Content_Types\Module::instance()->manager->get_content_types( 'content_type_slug' );
if ( ! $content_type) {
return $result;
}
//$args is an array of arguments
//like
$args = array (
array (
'field' => 'num1',
'operator' => '=',
'value' => 0,
'type' => 'integer',
),
array (
'field' => 'cct_status',
'operator' => '=',
'value' => 'publish',
'type' => 'CHAR',
),
);
$result = $content_type->db->query( $args, $limit, $offset, $order );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment