Function Reference: geodir_register_post_types

Summary

Register the post types.

Global Values

$wp_post_types
(array) (required) List of post types.

Default: None

Change Log

Since: 1.0.0

Filters

‘geodir_post_type_args’ [Line: 82]

Source File

geodir_register_post_types() is located in geodirectory-functions/custom_taxonomy_hooks_actions.php [Line: 48]

Source Code

function geodir_register_post_types() {
    global $wp_post_types;
    
    /**
     * Get available custom posttypes and taxonomies and register them.
     */
    _x('places', 'URL slug', 'geodirectory');

    $post_types = array();
    $post_types = get_option('geodir_post_types');

    // Register each post type if array of data is returned
    if (is_array($post_types)):

        foreach ($post_types as $post_type => $args):

            if (!empty($args['rewrite']['slug'])) {
                $args['rewrite']['slug'] = _x($args['rewrite']['slug'], 'URL slug', 'geodirectory');
            }
            $args = stripslashes_deep($args);

            if (!empty($args['labels'])) {
                foreach ($args['labels'] as $key => $val) {
                    $args['labels'][$key] = __($val, 'geodirectory');// allow translation
                }
            }

            /**
             * Filter post type args.
             *
             * @since 1.0.0
             * @param string $args Post type args.
             * @param string $post_type The post type.
             */
            $args = apply_filters('geodir_post_type_args', $args, $post_type);

            $post_type = register_post_type($post_type, $args);

        endforeach;
    endif;
}