/** * Generate conditional fields for the "slides" slideshow type. * @since 1.0.0 * @return array $fields An array of fields. */ public function generate_conditional_fields_slides() { global $wooslider; $images_url = $wooslider->plugin_url . '/assets/images/'; $fields = array(); // Categories. $terms = get_terms('slide-page'); $terms_options = array(); if (!is_wp_error($terms)) { foreach ($terms as $k => $v) { $terms_options[$v->slug] = $v->name; } } $categories_args = array('key' => 'slide_page', 'data' => array('options' => $terms_options)); $limit_options = array(); for ($i = 1; $i <= 20; $i++) { $limit_options[$i] = $i; } $thumbnails = WooSlider_Utils::get_thumbnail_options(); $thumbnails_options = array(); foreach ($thumbnails as $k => $v) { $thumbnails_options[$k] = $v['name']; } //Adding layout options $layout_types = WooSlider_Utils::get_posts_layout_types(); $layout_options = array(); foreach ((array) $layout_types as $k => $v) { $layout_options[$k] = $v['name']; } $layout_images = array('text-left' => esc_url($images_url . 'text-left.png'), 'text-right' => esc_url($images_url . 'text-right.png'), 'text-top' => esc_url($images_url . 'text-top.png'), 'text-bottom' => esc_url($images_url . 'text-bottom.png')); $layouts_args = array('key' => 'layout', 'data' => array('options' => $layout_options, 'images' => $layout_images)); //Add overlay options $overlay_images = array('none' => esc_url($images_url . 'default.png'), 'full' => esc_url($images_url . 'text-bottom.png'), 'natural' => esc_url($images_url . 'overlay-natural.png')); $overlay_options = array('none' => __('None', 'wooslider'), 'full' => __('Full', 'wooslider'), 'natural' => __('Natural', 'wooslider')); $overlay_args = array('key' => 'overlay', 'data' => array('options' => $overlay_options, 'images' => $overlay_images)); $order_values = WooSlider_Utils::get_order_options(); $order_options = array(); foreach ($order_values as $k => $v) { $order_options[$k] = $v['name']; } $order_by_values = WooSlider_Utils::get_order_by_options(); $order_by_options = array(); foreach ($order_by_values as $k => $v) { $order_by_options[$k] = $v['name']; } $carousel_columns = array(); for ($i = 1; $i <= 5; $i++) { $carousel_columns[$i] = $i; } // Image size options $image_size_options = array('thumbnail' => __('Thumbnail', 'wooslider'), 'medium' => __('Medium', 'wooslider'), 'large' => __('Large', 'wooslider'), 'full' => __('Full', 'wooslider')); $image_size_args = array('key' => 'size', 'data' => array('options' => $image_size_options, 'default' => 'large')); $limit_args = array('key' => 'limit', 'data' => array('options' => $limit_options, 'default' => 5)); $link_slide_args = array('key' => 'link_slide', 'data' => array()); $display_title_args = array('key' => 'display_title', 'data' => array()); $display_content_args = array('key' => 'display_content', 'data' => array('default' => '1')); $imageslide_args = array('key' => 'imageslide', 'data' => array()); $carousel_args = array('key' => 'carousel', 'data' => array()); $carousel_columns_args = array('key' => 'carousel_columns', 'data' => array('options' => $carousel_columns, 'default' => 3)); $thumbnails_args = array('key' => 'thumbnails', 'data' => array('options' => $thumbnails_options, 'default' => 'Default')); $display_featured_image_args = array('key' => 'display_featured_image', 'data' => array()); $order_args = array('key' => 'order', 'data' => array('options' => $order_options, 'default' => 'DESC')); $order_by_args = array('key' => 'order_by', 'data' => array('options' => $order_by_options, 'default' => 'date')); // Create final array. $fields['limit'] = array('name' => __('Number of Slides', 'wooslider'), 'type' => 'select', 'args' => $limit_args, 'description' => __('The maximum number of slides to display', 'wooslider')); $fields['slide_page'] = array('name' => __('Slide Groups', 'wooslider'), 'type' => 'multicheck', 'args' => $categories_args, 'description' => __('The slide groups from which to display slides', 'wooslider')); $fields['imageslide'] = array('name' => __('Use featured image as slide (allows for overlays)', 'wooslider'), 'type' => 'checkbox', 'args' => $imageslide_args, 'description' => __('Display featured image as background of slide', 'wooslider')); $fields['size'] = array('name' => __('Image Size', 'wooslider'), 'type' => 'select', 'args' => $image_size_args, 'description' => __('Select the image size for this slider.', 'wooslider')); $fields['carousel'] = array('name' => __('Make this slider a carousel', 'wooslider'), 'type' => 'checkbox', 'args' => $carousel_args, 'description' => __('Display multiple slides at a time with a carousel', 'wooslider')); $fields['carousel_columns'] = array('name' => __('Number of carousel columns', 'wooslider'), 'type' => 'select', 'args' => $carousel_columns_args, 'description' => __('The maximum number of visible images in the carousel', 'wooslider')); $fields['thumbnails'] = array('name' => __('Use thumbnails for Pagination', 'wooslider'), 'type' => 'select', 'args' => $thumbnails_args, 'description' => __('Use thumbnails for pagination, instead of "dot" indicators (uses featured image)', 'wooslider')); $fields['link_slide'] = array('name' => __('Link the slide to it\'s custom url', 'wooslider'), 'type' => 'checkbox', 'args' => $link_slide_args, 'description' => __('Link the slide to it\'s custom URL', 'wooslider')); $fields['display_title'] = array('name' => __('Display the slide title', 'wooslider'), 'type' => 'checkbox', 'args' => $display_title_args, 'description' => __('Display the slide title', 'wooslider')); $fields['display_content'] = array('name' => __('Display the slide\'s content', 'wooslider'), 'type' => 'checkbox', 'args' => $display_content_args, 'description' => __('Display the slide\'s content on each slide', 'wooslider')); $fields['layout'] = array('name' => __('Layout', 'wooslider'), 'type' => 'images', 'args' => $layouts_args, 'description' => __('The layout to use when displaying posts', 'wooslider')); $fields['overlay'] = array('name' => __('Overlay', 'wooslider'), 'type' => 'images', 'args' => $overlay_args, 'description' => __('The type of overlay to use when displaying the post text', 'wooslider')); $fields['order_by'] = array('name' => __('Order By', 'wooslider'), 'type' => 'select', 'args' => $order_by_args, 'description' => __('Parameter by which to order slides', 'wooslider')); $fields['order'] = array('name' => __('Order of Slides', 'wooslider'), 'type' => 'select', 'args' => $order_args, 'description' => __('Display in increasing or decreasing order', 'wooslider')); return $fields; }