通过ID获取文章的类型
举例:
1)
if ( 'post' === get_post_type() )
2)
<?php echo get_post_type( $post ) ?>
3)
<?php echo 'The post type is: ' . get_post_type( get_the_ID() ); ?>
参数
$post
(mixed) (可选) Post object or post ID. If empty, the current post will be used.
默认值: null
返回值
(boolean|string)
post type or false on failure.