| 1 |
<?php |
| 2 |
/** |
| 3 |
* GamiPress compatibility with newest WordPress functions |
| 4 |
* |
| 5 |
* @package GamiPress\Compatibility\WordPress |
| 6 |
* @author GamiPress <contact@gamipress.com>, Ruben Garcia <rubengcdev@gmail.com> |
| 7 |
* @since 1.4.9 |
| 8 |
*/ |
| 9 |
// Exit if accessed directly |
| 10 |
if( !defined( 'ABSPATH' ) ) exit; |
| 11 |
|
| 12 |
if( ! function_exists( 'get_post_types_by_support' ) ) : |
| 13 |
|
| 14 |
/** |
| 15 |
* Retrieves a list of post type names that support a specific feature. |
| 16 |
* |
| 17 |
* @since 4.5.0 |
| 18 |
* |
| 19 |
* @global array $_wp_post_type_features Post type features |
| 20 |
* |
| 21 |
* @param array|string $feature Single feature or an array of features the post types should support. |
| 22 |
* @param string $operator Optional. The logical operation to perform. 'or' means |
| 23 |
* only one element from the array needs to match; 'and' |
| 24 |
* means all elements must match; 'not' means no elements may |
| 25 |
* match. Default 'and'. |
| 26 |
* @return array A list of post type names. |
| 27 |
*/ |
| 28 |
function get_post_types_by_support( $feature, $operator = 'and' ) { |
| 29 |
global $_wp_post_type_features; |
| 30 |
|
| 31 |
$features = array_fill_keys( (array) $feature, true ); |
| 32 |
|
| 33 |
return array_keys( wp_filter_object_list( $_wp_post_type_features, $features, $operator ) ); |
| 34 |
} |
| 35 |
|
| 36 |
endif; |
| 37 |
|
| 38 |
if( ! function_exists( 'do_blocks' ) ) : |
| 39 |
|
| 40 |
/** |
| 41 |
* Parses dynamic blocks out of `post_content` and re-renders them. |
| 42 |
* |
| 43 |
* @since 5.0.0 |
| 44 |
* |
| 45 |
* @param string $content Post content. |
| 46 |
* @return string Updated post content. |
| 47 |
*/ |
| 48 |
function do_blocks( $content ) { |
| 49 |
return $content; |
| 50 |
} |
| 51 |
|
| 52 |
endif; |