Last active
July 26, 2019 14:57
-
-
Save tobiasschutter/ab2643a55baa9df4000be2f2ee564759 to your computer and use it in GitHub Desktop.
Admin Columns Pro API method for fetching layouts by post type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param string $post_type | |
* | |
* @return \ACP\Layout[] | |
*/ | |
function acp_get_layouts_by_post_type( string $post_type ) : array { | |
$list_screen = new \ACP\ListScreen\Post( $post_type ); | |
$layouts = new \ACP\Layouts( $list_screen ); | |
return $layouts->get_layouts(); | |
} | |
/** | |
* Example Usage | |
*/ | |
add_action( 'admin_init', function() { | |
$layouts = acp_get_layouts_by_post_type( 'post' ); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment