'post', 'orderby' => 'name', 'order' => 'ASC', ] ); $category_choices = [ 'all_categories' => __( 'All categories', 'blocksy' ), ]; foreach ( $categories as $category ) { $category_choices[ $category->term_id ] = $category->name; } $options = [ 'title' => [ 'type' => 'text', 'label' => __( 'Title', 'blocksy' ), 'field_attr' => [ 'id' => 'widget-title' ], 'design' => 'inline', ], 'type' => [ 'type' => 'ct-select', 'label' => __( 'Select Type', 'blocksy' ), 'value' => 'recent', 'design' => 'inline', 'choices' => blocksy_ordered_keys( [ 'recent' => __( 'Recent Posts', 'blocksy' ), 'popular' => __( 'Popular Posts', 'blocksy' ), 'commented' => __( 'Most Commented Posts', 'blocksy' ), ] ), ], 'days' => [ 'type' => 'ct-select', 'label' => __( 'Days', 'blocksy' ), 'value' => 'all_time', 'design' => 'inline', 'choices' => blocksy_ordered_keys( [ 'all_time' => __( 'All Time', 'blocksy' ), '7' => __( '1 Week', 'blocksy' ), '30' => __( '1 Month', 'blocksy' ), '90' => __( '3 Months', 'blocksy' ), '180' => __( '6 Months', 'blocksy' ), '360' => __( '1 Year', 'blocksy' ), ] ), ], 'category' => [ 'type' => 'ct-select', 'label' => __( 'Category', 'blocksy' ), 'value' => 'all_categories', 'choices' => blocksy_ordered_keys( $category_choices ), 'design' => 'inline', ], 'posts_number' => [ 'type' => 'ct-number', 'label' => __( 'Number of Posts', 'blocksy' ), 'min' => 1, 'max' => 30, 'value' => 5, 'design' => 'inline', ], 'display_date' => [ 'type' => 'ct-switch', 'label' => __( 'Show Date', 'blocksy' ), 'value' => 'no', ], 'display_photo' => [ 'type' => 'ct-switch', 'label' => __( 'Show Photo', 'blocksy' ), 'value' => 'no', ], 'display_comments' => [ 'type' => 'ct-switch', 'label' => __( 'Show Comments', 'blocksy' ), 'value' => 'no', ], ];