PluginProbe
Advanced Custom Fields (ACF®) / 5.8.8
Advanced Custom Fields (ACF®) v5.8.8
6.8.9 6.8.8 6.8.7 6.8.6 6.8.5 6.8.4 6.8.3 6.8.2 6.8.1 5.8.5 5.8.6 5.8.7 5.8.8 5.8.9 5.9.0 5.9.1 5.9.2 5.9.3 5.9.4 5.9.5 5.9.6 5.9.7 5.9.8 5.9.9 6.0.0 All 230 releases
advanced-custom-fields / includes / acf-post-functions.php
acf-post-functions.php
34 lines 655 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * acf_get_post_templates
5 *
6 * Returns an array of post_type => templates data.
7 *
8 * @date 29/8/17
9 * @since 5.6.2
10 *
11 * @param void
12 * @return array
13 */
14 function acf_get_post_templates() {
15
16 // Defaults.
17 $post_templates = array(
18 'page' => array()
19 );
20
21 // Loop over post types and append their templates.
22 if( method_exists('WP_Theme', 'get_page_templates') ) {
23 $post_types = acf_get_post_types();
24 foreach( $post_types as $post_type ) {
25 $templates = wp_get_theme()->get_page_templates( null, $post_type );
26 if( $templates ) {
27 $post_templates[ $post_type ] = $templates;
28 }
29 }
30 }
31
32 // Return.
33 return $post_templates;
34 }