PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / trunk
Shortcodes and extra features for Phlox theme vtrunk
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elements / tab-widget.php
auxin-elements / includes / elements Last commit date
about-widget.php 5 months ago accordion-widget.php 1 month ago accordion.php 5 months ago attachment-url.php 5 months ago audio.php 5 months ago before-after.php 5 months ago button.php 5 months ago code.php 5 months ago contact-box.php 5 months ago contact-form.php 5 months ago custom-list.php 5 months ago divider.php 5 months ago dropcap.php 5 months ago facebook.php 5 months ago flickr.php 5 months ago gallery.php 5 months ago gmap.php 5 months ago highlight.php 5 months ago image.php 5 months ago instagram-feed.php 5 months ago latest-posts-slider.php 5 months ago popular-posts-widget.php 5 months ago products-grid.php 5 months ago quote.php 5 months ago recent-posts-grid-carousel.php 5 months ago recent-posts-land-style.php 5 months ago recent-posts-masonry.php 5 months ago recent-posts-tiles-carousel.php 5 months ago recent-posts-tiles.php 5 months ago recent-posts-timeline.php 5 months ago recent-posts-widget.php 5 months ago recent-products.php 5 months ago related-posts.php 8 years ago sample-element.php 5 months ago search.php 5 months ago socials-list.php 5 months ago staff.php 5 months ago tab-widget.php 5 months ago tabs.php 5 months ago testimonial.php 5 months ago text.php 5 months ago touch-slider.php 5 months ago video.php 5 months ago
tab-widget.php
264 lines
1 <?php
2 /**
3 * Tabs Element just For Widgets
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2026 averta
11 */
12 function auxin_get_tabs_widget_master_array( $master_array ) {
13
14 $master_array['aux_tabs_widget'] = array( // shortcode info here
15 'name' => __('Tabs', 'auxin-elements'),
16 'auxin_output_callback' => 'auxin_get_tabs_widget_callback',
17 'base' => 'aux_tabs_widget',
18 'description' => __('It adds tabs element.', 'auxin-elements'),
19 'class' => 'aux-widget-tabs',
20 'show_settings_on_create' => true,
21 'weight' => 1,
22 'is_widget' => true,
23 'is_shortcode' => true,
24 'category' => THEME_NAME,
25 'group' => '',
26 'admin_enqueue_js' => '',
27 'admin_enqueue_css' => '',
28 'front_enqueue_js' => '',
29 'front_enqueue_css' => '',
30 'icon' => 'aux-element aux-pb-icons-tab',
31 'custom_markup' => '',
32 'js_view' => '',
33 'html_template' => '',
34 'deprecated' => '',
35 'content_element' => '',
36 'as_parent' => '',
37 'as_child' => '',
38 'params' => array(
39 array(
40 'heading' => __('Title','auxin-elements'),
41 'description' => __('Tabs title, leave it empty if you don`t need title.', 'auxin-elements'),
42 'param_name' => 'title',
43 'type' => 'textfield',
44 'value' => '',
45 'holder' => 'textfield',
46 'class' => 'title',
47 'admin_label' => true,
48 'dependency' => '',
49 'weight' => '',
50 'group' => '' ,
51 'edit_field_class' => ''
52 ),
53 array(
54 'heading' => __('Style', 'auxin-elements'),
55 'description' => __('Choose between bordered style and no border.', 'auxin-elements'),
56 'param_name' => 'style',
57 'type' => 'dropdown',
58 'def_value' => 'bordered',
59 'holder' => '',
60 'class' => 'style',
61 'value' =>array (
62 'bordered' => __('Bordered', 'auxin-elements'),
63 'aux-stripe' => __('No border', 'auxin-elements'),
64 ),
65 'admin_label' => true,
66 'dependency' => '',
67 'weight' => '',
68 'group' => '' ,
69 'edit_field_class' => ''
70 ),
71 array(
72 'heading' => __('First Tab Label','auxin-elements'),
73 'description' => __('Enter your tab item label.', 'auxin-elements'),
74 'param_name' => 'first_tab_label',
75 'type' => 'textfield',
76 'value' => '',
77 'holder' => 'textfield',
78 'class' => 'tab_label',
79 'admin_label' => true,
80 'dependency' => '',
81 'weight' => '',
82 'group' => '' ,
83 'edit_field_class' => ''
84 ),
85 array(
86 'heading' => __('First Tab Content', 'auxin-elements'),
87 'description' => __('Enter your tab item content.', 'auxin-elements'),
88 'param_name' => 'first_content',
89 'type' => 'textarea_html',
90 'value' => '',
91 'def_value' => '',
92 'holder' => 'div',
93 'class' => 'content',
94 'admin_label' => true,
95 'dependency' => '',
96 'weight' => '',
97 'group' => '',
98 'edit_field_class' => ''
99 ),
100 array(
101 'heading' => __('Second Tab Label','auxin-elements'),
102 'description' => __('Enter your tab item label.', 'auxin-elements'),
103 'param_name' => 'second_tab_label',
104 'type' => 'textfield',
105 'value' => '',
106 'holder' => 'textfield',
107 'class' => 'tab_label',
108 'admin_label' => true,
109 'dependency' => '',
110 'weight' => '',
111 'group' => '' ,
112 'edit_field_class' => ''
113 ),
114 array(
115 'heading' => __('Second Tab Content', 'auxin-elements'),
116 'description' => __('Enter your tab item content.', 'auxin-elements'),
117 'param_name' => 'second_content',
118 'type' => 'textarea_html',
119 'value' => '',
120 'def_value' => '',
121 'holder' => 'div',
122 'class' => 'content',
123 'admin_label' => true,
124 'dependency' => '',
125 'weight' => '',
126 'group' => '',
127 'edit_field_class' => ''
128 ),
129 array(
130 'heading' => __('Third Tab Label','auxin-elements'),
131 'description' => __('Enter your tab item label.', 'auxin-elements'),
132 'param_name' => 'third_tab_label',
133 'type' => 'textfield',
134 'value' => '',
135 'holder' => 'textfield',
136 'class' => 'tab_label',
137 'admin_label' => true,
138 'dependency' => '',
139 'weight' => '',
140 'group' => '' ,
141 'edit_field_class' => ''
142 ),
143 array(
144 'heading' => __('Third Tab Content', 'auxin-elements'),
145 'description' => __('Enter your tab item content.', 'auxin-elements'),
146 'param_name' => 'third_content',
147 'type' => 'textarea_html',
148 'value' => '',
149 'def_value' => '',
150 'holder' => 'div',
151 'class' => 'content',
152 'admin_label' => true,
153 'dependency' => '',
154 'weight' => '',
155 'group' => '',
156 'edit_field_class' => ''
157 ),
158 array(
159 'heading' => __('Extra class name','auxin-elements'),
160 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements'),
161 'param_name' => 'extra_classes',
162 'type' => 'textfield',
163 'value' => '',
164 'def_value' => '',
165 'holder' => 'textfield',
166 'class' => 'extra_classes',
167 'admin_label' => true,
168 'dependency' => '',
169 'weight' => '',
170 'group' => '' ,
171 'edit_field_class' => ''
172 )
173 )
174 );
175
176
177 return $master_array;
178 }
179
180 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_tabs_widget_master_array', 10, 1 );
181
182 /**
183 * Sample element markup for front-end
184 * In other words, the front-end output of this element is returned by the following function
185 *
186 *
187 * @param array $atts The array containing the parsed values from shortcode,it should be same as defined params above.
188 * @param string $shortcode_content The shorcode content
189 * @return string The output of element markup
190 */
191 function auxin_get_tabs_widget_callback( $atts, $shortcode_content = null ){
192
193 // Defining default attributes
194 $default_atts = array(
195 'title' => '', // header title
196 'style' => 'bordered', // header title
197 'first_tab_label' => '', // first label title
198 'first_content' => '', // first content
199 'second_tab_label' => '', // second title
200 'second_content' => '', // second content
201 'third_tab_label' => '', // third title
202 'third_content' => '', // third content
203 'extra_classes' => '', // custom css class names for this element
204 'custom_el_id' => '', // custom id attribute for this element
205 'base_class' => 'aux-widget-tabs' // base class name for container
206 );
207
208 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
209 $output = '';
210 $tabs_count = 0;
211 $tabs_info = array () ;
212 $tabs_markup = '';
213 $tabs_content_markup = '';
214
215 extract( $result['parsed_atts'] );
216
217 $tabs_info = array (
218 array( 'label' => $first_tab_label , 'content' => $first_content ),
219 array( 'label' => $second_tab_label , 'content' => $second_content ),
220 array( 'label' => $third_tab_label , 'content' => $third_content )
221 );
222
223 foreach ( $tabs_info as $tab ) {
224
225 if ( !empty ( $tab['label'] ) ) {
226 $tabs_markup .= '<li><a href="#">' . esc_html ( $tab['label'] ) . '</a></li>';
227 $tabs_content_markup .= '<li>' . auxin_kses( $tab['content'] ) . '</li>';
228 $tabs_count++;
229 }
230
231
232 }
233
234 $style = 'bordered' === $style ? '': 'aux-stripe aux-fill ';
235 $widget_class = 'widget-tabs ' . esc_attr( $style ) . esc_attr( $extra_classes ) ;
236
237 // widget header ------------------------------
238 $output .= $result['widget_header'];
239 $output .= $result['widget_title'];
240
241 // widget custom output -----------------------
242 $output .= '<div class="'. esc_attr( $widget_class ) .'">';
243 $output .= '<div class="widget-inner">';
244
245 if( $tabs_count > 1 ){
246 $output .= '<ul class="tabs">';
247 $output .= $tabs_markup ;
248 $output .= '</ul>';
249 }
250
251 $output .= '<ul class="tabs-content">';
252 $output .= $tabs_content_markup ;
253 $output .= '</ul>';
254
255 $output .= '</div>';
256 $output .= '</div>' ;
257
258
259 // widget footer ------------------------------
260 $output .= $result['widget_footer'];
261
262 return $output;
263 }
264