Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- trait WCP_Responsive_Posts_Carousel_Fields
- {
- /**
- * Returns carousel settings tabs.
- * since 1.0
- */
- function rpc_settings_tabs() {
- $tabs = array(
- array(
- 'label' => __( 'Content', 'responsive-posts-carousel' ),
- 'name' => 'contents',
- 'icon' => '<span class="dashicons dashicons-media-text"></span>',
- ),
- array(
- 'label' => __( 'Slider', 'responsive-posts-carousel' ),
- 'name' => 'slider',
- 'icon' => '<span class="dashicons dashicons-slides"></span>',
- ),
- array(
- 'label' => __( 'Colors & CSS', 'responsive-posts-carousel' ),
- 'name' => 'colors',
- 'icon' => '<span class="dashicons dashicons-admin-appearance"></span>',
- ),
- array(
- 'label' => __( 'Typography', 'responsive-posts-carousel' ),
- 'name' => 'typography',
- 'icon' => '<span class="dashicons dashicons-editor-spellcheck"></span>',
- ),
- array(
- 'label' => __( 'Arrows', 'responsive-posts-carousel' ),
- 'name' => 'arrows',
- 'icon' => '<span class="dashicons dashicons-leftright"></span>',
- ),
- array(
- 'label' => __( 'Advanced', 'responsive-posts-carousel' ),
- 'name' => 'advanced',
- 'icon' => '<span class="dashicons dashicons-admin-generic"></span>',
- ),
- );
- return apply_filters( 'rpc_admin_setting_tabs', $tabs );
- }
- /**
- * Returns carousel settings fields.
- * since 1.0
- */
- function rpc_settings_fields()
- {
- $fields = array(
- array(
- 'key' => 'taxonomy',
- 'type' => 'taxonomy',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Select Taxonomy', 'responsive-posts-carousel' ),
- 'help' => __( 'Select Taxonomy', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('term', ''),
- 'type' => 'term',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Select Term', 'responsive-posts-carousel' ),
- 'help' => __( 'Select Terms', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('query', 'post_type'),
- 'type' => 'post_type',
- 'tab' => 'contents',
- 'default' => ['post'],
- 'title' => __( 'Select Post Type', 'responsive-posts-carousel' ),
- 'help' => __( 'Select Post Type', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('query', 'post__in'),
- 'type' => 'post__in',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Select Posts', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose posts to display in carousel', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('query', 'post__not_in'),
- 'type' => 'text',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Exclude Posts', 'responsive-posts-carousel' ),
- 'help' => __( 'Comma separated ids of posts that you do not want to display', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('query', 'posts_per_page'),
- 'type' => 'number',
- 'tab' => 'contents',
- 'default' => 20,
- 'title' => __( 'Total Posts', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide slide (posts) amount to display', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'hover_effect',
- 'type' => 'carousel_styles',
- 'tab' => 'contents',
- 'default' => 'none',
- 'title' => __( 'Post Style', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose post style to display in slider', 'responsive-posts-carousel' ),
- 'options'=> [
- 'none',
- 'mini post',
- 'post card',
- 'no thumbnails',
- 'post display style 1',
- 'post display style 2',
- 'post display style 3',
- 'square effect1 left_and_right',
- 'square effect1 top_to_bottom',
- 'square effect1 bottom_to_top',
- 'square effect2',
- 'square effect3 bottom_to_top',
- 'square effect3 top_to_bottom',
- 'square effect4',
- 'square effect5 left_to_right',
- 'square effect5 right_to_left',
- 'square effect6 from_top_and_bottom',
- 'square effect6 from_left_and_right',
- 'square effect6 top_to_bottom',
- 'square effect6 bottom_to_top',
- 'square effect7',
- 'square effect8 scale_up',
- 'square effect8 scale_down',
- 'square effect9 bottom_to_top',
- 'square effect9 left_to_right',
- 'square effect9 right_to_left',
- 'square effect9 top_to_bottom',
- 'square effect10 left_to_right',
- 'square effect10 right_to_left',
- 'square effect10 top_to_bottom',
- 'square effect10 bottom_to_top',
- 'square effect11 left_to_right',
- 'square effect11 right_to_left',
- 'square effect11 top_to_bottom',
- 'square effect11 bottom_to_top',
- 'square effect12 left_to_right',
- 'square effect12 right_to_left',
- 'square effect12 top_to_bottom',
- 'square effect12 bottom_to_top',
- 'square effect13 left_to_right',
- 'square effect13 right_to_left',
- 'square effect13 top_to_bottom',
- 'square effect13 bottom_to_top',
- 'square effect14 left_to_right',
- 'square effect14 right_to_left',
- 'square effect14 top_to_bottom',
- 'square effect14 bottom_to_top',
- 'square effect15 left_to_right',
- 'square effect15 right_to_left',
- 'square effect15 top_to_bottom',
- 'square effect15 bottom_to_top',
- ]
- ),
- array(
- 'key' => 'title',
- 'type' => 'text',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Title', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide post meta key to display as heading.', 'responsive-posts-carousel' ).' '.
- __( 'Example', 'responsive-posts-carousel' ).' '.
- '<code>post_title</code>, <code>post_date</code>, <code>content</code>, <code>post_author</code>, <code>excerpt</code>, <code>none</code>',
- ),
- array(
- 'key' => 'desc',
- 'type' => 'text',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Content', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide post meta key to display as description.', 'responsive-posts-carousel' ).' '.
- __( 'Example', 'responsive-posts-carousel' ).' '.
- '<code>post_title</code>, <code>post_date</code>, <code>content</code>, <code>post_author</code>, <code>excerpt</code>, <code>none</code>',
- ),
- array(
- 'key' => 'words',
- 'type' => 'number',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Description Words Length', 'responsive-posts-carousel' ),
- 'help' => __( 'Maximum words to display for description.', 'responsive-posts-carousel' ).' '.
- __( 'Example', 'responsive-posts-carousel' ).' <code>30</code>',
- ),
- array(
- 'key' => 'read_more_txt',
- 'type' => 'text',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Read More Button Text', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide text for read more button, leave blank to disable', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'read_more_target',
- 'type' => 'select',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Link Target', 'responsive-posts-carousel' ),
- 'help' => __( 'How you want to open links', 'responsive-posts-carousel' ),
- 'options' => array(
- '_self' => __( 'Same Tab', 'responsive-posts-carousel' ),
- '_blank' => __( 'New Tab', 'responsive-posts-carousel' ),
- ),
- ),
- array(
- 'key' => 'hidemeta',
- 'type' => 'checkbox',
- 'tab' => 'contents',
- 'default' => '',
- 'title' => __( 'Disable Post Meta (author, date etc)', 'responsive-posts-carousel' ),
- 'help' => __( 'Check this button to hide post meta', 'responsive-posts-carousel' ),
- ),
- // Slider
- array(
- 'key' => array('slider', 'accessibility'),
- 'type' => 'checkbox',
- 'tab' => 'slider',
- 'default' => 'on',
- 'title' => __( 'Accessibility', 'responsive-posts-carousel' ),
- 'help' => __( 'Enables tabbing and arrow key navigation', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('slider', 'autoplay'),
- 'type' => 'checkbox',
- 'tab' => 'slider',
- 'default' => 'on',
- 'title' => __( 'Auto Play', 'responsive-posts-carousel' ),
- 'help' => __( 'Enables auto play of slides', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('slider', 'dots'),
- 'type' => 'checkbox',
- 'tab' => 'slider',
- 'default' => 'on',
- 'title' => __( 'Bottom Dots', 'responsive-posts-carousel' ),
- 'help' => __( 'Check to enable current slide indicator dots', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('slider', 'arrows'),
- 'type' => 'checkbox',
- 'tab' => 'arrows',
- 'default' => 'on',
- 'title' => __( 'Arrows', 'responsive-posts-carousel' ),
- 'help' => __( 'Check to enable Next/Prev arrows', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('slider', 'autoplaySpeed'),
- 'type' => 'number',
- 'tab' => 'slider',
- 'default' => '',
- 'title' => __( 'Auto Play Speed', 'responsive-posts-carousel' ),
- 'help' => __( 'Auto play change interval in milliseconds', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('slider', 'slidesToShow'),
- 'type' => 'number',
- 'tab' => 'slider',
- 'default' => '3',
- 'title' => __( 'Number of Columns (Desktop)', 'responsive-posts-carousel' ),
- 'help' => __( 'Number of posts to show at a time in a row for desktop view', 'responsive-posts-carousel' ).' <code>992px+</code>',
- ),
- array(
- 'key' => array('slider', 'slidesToShowtab'),
- 'type' => 'number',
- 'tab' => 'slider',
- 'default' => '2',
- 'title' => __( 'Number of Columns (Tablet)', 'responsive-posts-carousel' ),
- 'help' => __( 'Number of posts to show at a time in a row for tablet view', 'responsive-posts-carousel' ).' <code>992px-</code>',
- ),
- array(
- 'key' => array('slider', 'slidesToShowmob'),
- 'type' => 'number',
- 'tab' => 'slider',
- 'default' => '1',
- 'title' => __( 'Number of Columns (Mobile)', 'responsive-posts-carousel' ),
- 'help' => __( 'Number of posts to show at a time in a row for mobile view', 'responsive-posts-carousel' ).' <code>768px-</code>',
- ),
- array(
- 'key' => array('slider', 'speed'),
- 'type' => 'number',
- 'tab' => 'slider',
- 'default' => '250',
- 'title' => __( 'Slide Speed', 'responsive-posts-carousel' ),
- 'help' => __( 'Transition speed in milliseconds', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('slider', 'margin'),
- 'type' => 'text',
- 'tab' => 'slider',
- 'default' => '20px',
- 'title' => __( 'Space Between Posts', 'responsive-posts-carousel' ),
- 'help' => __( 'Margin will apply to both sides. Provide with unit.', 'responsive-posts-carousel' ).' '.
- __( 'Example', 'responsive-posts-carousel' ).' <code>20px</code>',
- ),
- // COlors
- array(
- 'key' => 'border_width',
- 'type' => 'text',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Border Width', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide width for border with unit. Leave blank to disable border.', 'responsive-posts-carousel' ).' '
- .__( 'Example', 'responsive-posts-carousel' ).' <code>2px</code>',
- ),
- array(
- 'key' => 'border_color',
- 'type' => 'color',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Border Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose color for border', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'border_type',
- 'type' => 'select',
- 'tab' => 'colors',
- 'default' => '',
- 'options' => array(
- 'solid' => __( 'Solid', 'responsive-posts-carousel' ),
- 'dotted' => __( 'Dotted', 'responsive-posts-carousel' ),
- 'dashed' => __( 'Dashed', 'responsive-posts-carousel' ),
- 'double' => __( 'Double', 'responsive-posts-carousel' ),
- 'groove' => __( 'Groove', 'responsive-posts-carousel' ),
- 'ridge' => __( 'Ridge', 'responsive-posts-carousel' ),
- 'inset' => __( 'Inset', 'responsive-posts-carousel' ),
- 'outset' => __( 'Outset', 'responsive-posts-carousel' ),
- ),
- 'title' => __( 'Border Type', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose type for border', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'title_bg',
- 'type' => 'color',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Title Background Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose Title Background Color.', 'responsive-posts-carousel' ).' '.
- __( 'Leave blank for default settings.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'title_color',
- 'type' => 'color',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Title Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose Title text color.', 'responsive-posts-carousel' ).' '.
- __( 'Leave blank for default settings.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'desc_color',
- 'type' => 'color',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Description Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose description text color.', 'responsive-posts-carousel' ).' '.
- __( 'Leave blank for default settings.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'desc_bg',
- 'type' => 'color',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Description Background Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose description background color.', 'responsive-posts-carousel' ).' '.
- __( 'Leave blank for default settings.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'date_bg_color',
- 'type' => 'color',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Date Background Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose date background color.', 'responsive-posts-carousel' ).' '.
- __( 'Leave blank for default settings.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'date_text_color',
- 'type' => 'color',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Date Text Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose date text color.', 'responsive-posts-carousel' ).' '.
- __( 'Leave blank for default settings.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'overlay_bg_color',
- 'type' => 'color',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Overlay Background Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose color for overlay.', 'responsive-posts-carousel' ).' '.
- __( 'Leave blank for default settings.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'shadow',
- 'type' => 'text',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Shadow', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide shadow values as', 'responsive-posts-carousel' ).' <code>h-offset v-offset blur spread color</code> '.
- ' <a href="http://www.cssmatic.com/box-shadow" target="_blank">'.
- __( 'Generate Shadow', 'responsive-posts-carousel' ).
- '</a>',
- ),
- array(
- 'key' => 'read_more_classes',
- 'type' => 'text',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Read More Button CSS Classes', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide css classes for styling of button', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'custom_css',
- 'type' => 'textarea',
- 'tab' => 'colors',
- 'default' => '',
- 'title' => __( 'Custom CSS', 'responsive-posts-carousel' ),
- 'help' => __( 'Paste custom css code here', 'responsive-posts-carousel' ),
- ),
- // Typography
- array(
- 'key' => array('typo', 'title_font_family'),
- 'type' => 'text',
- 'tab' => 'typography',
- 'default' => '',
- 'title' => __( 'Title Font Family', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide font name for title', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('typo', 'title_font_size'),
- 'type' => 'text',
- 'tab' => 'typography',
- 'default' => '',
- 'title' => __( 'Title Font Size', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide font size for title with unit', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('typo', 'desc_font_family'),
- 'type' => 'text',
- 'tab' => 'typography',
- 'default' => '',
- 'title' => __( 'Description Font Family', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide font name for description', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('typo', 'desc_font_size'),
- 'type' => 'text',
- 'tab' => 'typography',
- 'default' => '',
- 'title' => __( 'Description Font Size', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide font size for description with unit', 'responsive-posts-carousel' ),
- ),
- // Arrows
- array(
- 'key' => array('arrow', 'type'),
- 'type' => 'select',
- 'tab' => 'arrows',
- 'default' => 'simple',
- 'title' => __( 'Arrows Type', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose navigation arrows type here', 'responsive-posts-carousel' ),
- 'options' => array(
- 'circle' => __( 'Circle', 'responsive-posts-carousel' ),
- 'circleinverted' => __( 'Circle Inverted', 'responsive-posts-carousel' ),
- 'simple' => __( 'Simple', 'responsive-posts-carousel' ),
- 'long' => __( 'Long', 'responsive-posts-carousel' ),
- 'angle' => __( 'Angle', 'responsive-posts-carousel' ),
- 'doubleangle' => __( 'Double Angle', 'responsive-posts-carousel' ),
- 'caret' => __( 'Caret', 'responsive-posts-carousel' ),
- 'caretsquare' => __( 'Caret Square', 'responsive-posts-carousel' ),
- 'hand' => __( 'Hand', 'responsive-posts-carousel' ),
- 'chevron' => __( 'Chevron', 'responsive-posts-carousel' ),
- ),
- ),
- array(
- 'key' => array('arrow', 'style'),
- 'type' => 'select',
- 'tab' => 'arrows',
- 'default' => 'circle',
- 'title' => __( 'Arrows Style', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose arrow appearance here', 'responsive-posts-carousel' ),
- 'options' => array(
- 'transparent' => __( 'Transparent', 'responsive-posts-carousel' ),
- 'square' => __( 'Square', 'responsive-posts-carousel' ),
- 'circle' => __( 'Circle', 'responsive-posts-carousel' ),
- ),
- ),
- array(
- 'key' => 'arrow_color',
- 'type' => 'color',
- 'tab' => 'arrows',
- 'default' => '#000',
- 'title' => __( 'Arrows Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose arrow color', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('arrow', 'bgcolor'),
- 'type' => 'color',
- 'tab' => 'arrows',
- 'default' => '',
- 'title' => __( 'Arrows Background Color', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose arrow background color', 'responsive-posts-carousel' ),
- ),
- // Advanced Settings
- array(
- 'key' => 'images_size',
- 'type' => 'image_size',
- 'tab' => 'advanced',
- 'default' => '',
- 'title' => __( 'Images Size', 'responsive-posts-carousel' ),
- 'help' => __( 'Choose images size for thumbnails', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('slider', 'rows'),
- 'type' => 'number',
- 'tab' => 'advanced',
- 'default' => '',
- 'title' => __( 'Rows', 'responsive-posts-carousel' ),
- 'help' => __( 'Setting this to more than 1 initializes grid mode. Use slidesPerRow to set how many slides should be in each row.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'offset',
- 'type' => 'number',
- 'tab' => 'advanced',
- 'default' => '',
- 'title' => __( 'Skip Posts', 'responsive-posts-carousel' ),
- 'help' => __( 'Number of posts to skip from initial posts regarding current settings.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => array('slider', 'slidesPerRow'),
- 'type' => 'number',
- 'tab' => 'advanced',
- 'default' => '',
- 'title' => __( 'Slides Per Row', 'responsive-posts-carousel' ),
- 'help' => __( 'With grid mode initialized via the rows option, this sets how many slides are in each grid row.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'placeholder_image',
- 'type' => 'text',
- 'tab' => 'advanced',
- 'default' => '',
- 'title' => __( 'Placeholder Image Url', 'responsive-posts-carousel' ),
- 'help' => __( 'Provide placeholder image url for that posts which do not have featured images.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'disable_current_post',
- 'type' => 'checkbox',
- 'tab' => 'advanced',
- 'default' => '',
- 'title' => __( 'Disable Current Post', 'responsive-posts-carousel' ),
- 'help' => __( 'Check to exclude the current post from slider if you are using it under a post.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'equal_height_mode',
- 'type' => 'checkbox',
- 'tab' => 'advanced',
- 'default' => '',
- 'title' => __( 'Equal Height Mode', 'responsive-posts-carousel' ),
- 'help' => __( 'Checking this make all images same in height.', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'images_height',
- 'type' => 'text',
- 'tab' => 'advanced',
- 'default' => '',
- 'title' => __( 'Images Height', 'responsive-posts-carousel' ),
- 'help' => __( 'Fixed Height for images in px. Eg: 450px', 'responsive-posts-carousel' ),
- ),
- array(
- 'key' => 'cache_minutes',
- 'type' => 'number',
- 'tab' => 'advanced',
- 'default' => 1,
- 'title' => __( 'Cache', 'responsive-posts-carousel' ),
- 'help' => __( 'How many minutes should the query be cached (set 0 for disable)', 'responsive-posts-carousel' ),
- ),
- );
- return apply_filters( 'rpc_admin_setting_fields', $fields );
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement