| 1 |
<?php |
| 2 |
/** |
| 3 |
* Functions |
| 4 |
* |
| 5 |
* @package GamiPress\JetEngine\Functions |
| 6 |
* @since 1.0.0 |
| 7 |
*/ |
| 8 |
// Exit if accessed directly |
| 9 |
if( !defined( 'ABSPATH' ) ) exit; |
| 10 |
|
| 11 |
/** |
| 12 |
* Check JetEngine post type |
| 13 |
* |
| 14 |
* @since 1.0.0 |
| 15 |
* |
| 16 |
* @param object $post Post data |
| 17 |
* |
| 18 |
* @return bool |
| 19 |
*/ |
| 20 |
function gamipress_jetengine_check_type( $post ) { |
| 21 |
|
| 22 |
$array_types = array(); |
| 23 |
|
| 24 |
if( ! class_exists( 'Jet_Engine_CPT' ) ) { |
| 25 |
return false; |
| 26 |
} |
| 27 |
|
| 28 |
// Get JetEngine post types |
| 29 |
$post_types_obj = jet_engine()->cpt; |
| 30 |
$post_types = $post_types_obj->get_items(); |
| 31 |
|
| 32 |
foreach( $post_types as $post_type ) { |
| 33 |
$array_types[] = $post_type['slug']; |
| 34 |
} |
| 35 |
|
| 36 |
// Bail if the post is not a JetEngine type |
| 37 |
if ( !in_array( $post->post_type, $array_types ) ){ |
| 38 |
return false; |
| 39 |
} |
| 40 |
|
| 41 |
return true; |
| 42 |
} |