protected function getWPPosttypes($options = [], $value = 'name')
    {
        // Build contents
        $contents = [];
        $contents[-1] = Translate::t('wordpress.choose.posttype', [], 'wordpressfield');

        // Build options
        $args = array_merge([], $options);

        // Build request
        $types_obj = get_post_types($args, 'object');

        // Iterate on posttypes
        if (!empty($types_obj)) {
            foreach ($types_obj as $typ) {
                // Check value
                $item = !empty($value) && isset($typ->$value) ? $typ->$value : $typ->name;

                // Get the the name
                $contents[0][$item] = $typ->labels->name.' ('.$typ->name.')';
            }
        }

        // Return all values in a well formatted way
        return $contents;
    }
protected function getWPPosttypes($options = [], $value = 'name')
    {
        // Build contents
        $contents = [];
        $contents[-1] = Translate::t('wordpress.choose.posttype', [], 'wordpressfield');

        // Build options
        $args = array_merge([], $options);

        // Build request
        $types_obj = get_post_types($args, 'object');

        // Iterate on posttypes
        if (!empty($types_obj)) {
            foreach ($types_obj as $typ) {
                // Check value
                $item = !empty($value) && isset($typ->$value) ? $typ->$value : $typ->name;

                // Get the the name
                $contents[0][$item] = $typ->labels->name.' ('.$typ->name.')';
            }
        }

        // Return all values in a well formatted way
        return $contents;
    }
protected function getWPPosttypes ( $ options = [ ] , $ value = 'name' ) { // Build contents $ contents = [ ] ; $ contents [ - 1 ] = Translate :: t ( 'wordpress.choose.posttype' , [ ] , 'wordpressfield' ) ; // Build options $ args = array_merge ( [ ] , $ options ) ; // Build request $ types_obj = get_post_types ( $ args , 'object' ) ; // Iterate on posttypes if ( ! empty ( $ types_obj ) ) { foreach ( $ types_obj as $ typ ) { // Check value $ item = ! empty ( $ value ) && isset ( $ typ -> $ value ) ? $ typ -> $ value : $ typ -> name ; // Get the the name $ contents [ 0 ] [ $ item ] = $ typ -> labels -> name . ' (' . $ typ -> name . ')' ; } } // Return all values in a well formatted way return $ contents ; }
Get WordPress Post Types registered.

@uses get_post_types()

@param   array  $options     Define options if needed
@param   string $value       Define the value of each select options
@return  array  $wpcontents  Array of WordPress items
Get WordPress Post Types registered .