get_post_type_class() static public method

static public get_post_type_class ( string $post_type ) : string | null
$post_type string
return string | null
Example #1
0
 /**
  * @param array $posts
  * @param array $args
  */
 function __construct($posts, $args = array())
 {
     if (isset($posts) && is_array($posts)) {
         $args = wp_parse_args($args, array('list_owner' => false));
         /**
          * @var WPLib_Posts $list_owner
          */
         $list_owner = $args['list_owner'];
         if (!$list_owner) {
             foreach ($posts as $index => $post) {
                 $posts[$index] = $list_owner::make_new_item($post, $args);
             }
         } else {
             foreach ($posts as $index => $post) {
                 $list_owner = $args['list_owner'] = WPLib_Posts::get_post_type_class($post->post_type);
                 $posts[$index] = $list_owner::make_new_item($post, $args);
             }
         }
     }
     parent::__construct($posts, $args);
 }