ACF_Location_Post_Template::get_object_subtype()
Returns the object_subtype connected to this location.
Метод класса: ACF_Location_Post_Template{}
Хуков нет.
Возвращает
Строку|Массив
.
Использование
$ACF_Location_Post_Template = new ACF_Location_Post_Template(); $ACF_Location_Post_Template->get_object_subtype( $rule );
- $rule(массив) (обязательный)
- A location rule.
Список изменений
С версии 5.9.0 | Введена. |
Код ACF_Location_Post_Template::get_object_subtype() ACF Location Post Template::get object subtype ACF 6.0.4
public function get_object_subtype( $rule ) { if ( $rule['operator'] === '==' ) { $post_templates = acf_get_post_templates(); // If "default", return array of all post types which have templates. if ( $rule['value'] === 'default' ) { return array_keys( $post_templates ); // Otherwise, generate list of post types that have the selected template. } else { $post_types = array(); foreach ( $post_templates as $post_type => $templates ) { if ( isset( $templates[ $rule['value'] ] ) ) { $post_types[] = $post_type; } } return $post_types; } } return ''; }