protected function loadPostTypes()
    {
        if ($config = $this->loadConfigFile('post_types.php')) {
            $callbacks = array();

            // Create one callback for each post type, and register in
            // init action

            foreach ($config as $postTypeName => $args) {
                $callbacks[] = $cb = function () use ($postTypeName, $args) {
                    register_post_type($postTypeName, $args);
                };

                add_action('init', $cb, 0);
            }

            // Flush URL caches for (you need to register custom post types
            // first)

            register_activation_hook($this->getPluginFile(), function () use ($callbacks) {
                foreach ($callbacks as $cb) {
                    $cb();
                }

                flush_rewrite_rules();
            });
        }

        return $this;
    }
protected function loadPostTypes()
    {
        if ($config = $this->loadConfigFile('post_types.php')) {
            $callbacks = array();

            // Create one callback for each post type, and register in
            // init action

            foreach ($config as $postTypeName => $args) {
                $callbacks[] = $cb = function () use ($postTypeName, $args) {
                    register_post_type($postTypeName, $args);
                };

                add_action('init', $cb, 0);
            }

            // Flush URL caches for (you need to register custom post types
            // first)

            register_activation_hook($this->getPluginFile(), function () use ($callbacks) {
                foreach ($callbacks as $cb) {
                    $cb();
                }

                flush_rewrite_rules();
            });
        }

        return $this;
    }
protected function loadPostTypes ( ) { if ( $ config = $ this -> loadConfigFile ( 'post_types.php' ) ) { $ callbacks = array ( ) ; // Create one callback for each post type, and register in // init action foreach ( $ config as $ postTypeName => $ args ) { $ callbacks [ ] = $ cb = function ( ) use ( $ postTypeName , $ args ) { register_post_type ( $ postTypeName , $ args ) ; } ; add_action ( 'init' , $ cb , 0 ) ; } // Flush URL caches for (you need to register custom post types // first) register_activation_hook ( $ this -> getPluginFile ( ) , function ( ) use ( $ callbacks ) { foreach ( $ callbacks as $ cb ) { $ cb ( ) ; } flush_rewrite_rules ( ) ; } ) ; } return $ this ; }
Load custom post types from configuration files.

@return \Tev\Plugin\Loader This, for chaining
Load custom post types from configuration files .