public function random() { $options = array(); $types = cptuiext_get_post_type_slugs(); foreach ( $types as $type ) { $options[ $type ] = $type; } $shortcode = array( 'id' => 'random', 'name' => __( 'Random Post', 'cptui-extended-random' ), 'template' => 'random', 'template_location' => $this->path . 'templates/', 'style' => 'cptui_default_css', 'post_type' => 'all', 'description' => __( 'Display a random post', 'cptui-extended-random' ), 'fields' => array( array( 'name' => __( 'Title', 'cptui-extended-random' ), 'id' => 'title', 'description' => __( 'Title to display above chosen random post', 'cptui-extended-random' ), 'type' => 'text', ), array( 'name' => __( 'Choose post type', 'cptui-extended-random' ), 'description' => __( 'Post type to choose random post from.', 'cptui-extended-random' ), 'id' => 'post_type', 'type' => 'select', 'default' => 'none', 'options' => $options, ), array( 'name' => __( 'Show post title as caption', 'cptui-extended-random' ), 'id' => 'show_caption', 'type' => 'select', 'default' => 'true', 'options' => array( 'true' => 'True', 'false' => 'False', ), ), ), ); return $shortcode; }