| 1 |
<?php |
| 2 |
/** |
| 3 |
* Functions |
| 4 |
* |
| 5 |
* @package AutomatorWP\Integrations\Favorites\Functions |
| 6 |
* @author AutomatorWP <[email protected]>, Ruben Garcia <[email protected]> |
| 7 |
* @since 1.0.0 |
| 8 |
*/ |
| 9 |
// Exit if accessed directly |
| 10 |
if( !defined( 'ABSPATH' ) ) exit; |
| 11 |
|
| 12 |
/** |
| 13 |
* Post type options callback |
| 14 |
* |
| 15 |
* @since 1.0.0 |
| 16 |
* |
| 17 |
* @return array |
| 18 |
*/ |
| 19 |
function automatorwp_favorites_post_type_cb() { |
| 20 |
|
| 21 |
$post_types = array(); |
| 22 |
|
| 23 |
// Get favorites post type display options |
| 24 |
$types = get_option('simplefavorites_display'); |
| 25 |
|
| 26 |
if ( ! empty( $types['posttypes'] ) && $types !== "" ) { |
| 27 |
|
| 28 |
foreach ( $types['posttypes'] as $key => $type ) { |
| 29 |
|
| 30 |
// If favorites display is active, then add the post type |
| 31 |
if ( isset( $type['display'] ) && $type['display'] == 'true' ) { |
| 32 |
$post_types[] = $key; |
| 33 |
} |
| 34 |
|
| 35 |
} |
| 36 |
|
| 37 |
} |
| 38 |
|
| 39 |
return $post_types; |
| 40 |
|
| 41 |
} |