PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.9.21
Shortcodes and extra features for Phlox theme v2.9.21
2.17.21 2.17.20 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 / sample-element.php
auxin-elements / includes / elements Last commit date
about-widget.php 4 years ago accordion-widget.php 4 years ago accordion.php 4 years ago attachment-url.php 4 years ago audio.php 4 years ago before-after.php 4 years ago button.php 4 years ago code.php 4 years ago contact-box.php 4 years ago contact-form.php 4 years ago custom-list.php 4 years ago divider.php 4 years ago dropcap.php 4 years ago facebook.php 4 years ago flickr.php 4 years ago gallery.php 4 years ago general-element-fields.php 4 years ago gmap.php 4 years ago highlight.php 4 years ago image.php 4 years ago instagram-feed.php 4 years ago latest-items.php 4 years ago latest-posts-slider.php 4 years ago popular-posts-widget.php 4 years ago products-grid.php 4 years ago quote.php 4 years ago recent-posts-grid-carousel.php 3 years ago recent-posts-land-style.php 4 years ago recent-posts-masonry.php 4 years ago recent-posts-tiles-carousel.php 3 years ago recent-posts-tiles.php 4 years ago recent-posts-timeline.php 4 years ago recent-posts-widget.php 4 years ago recent-products.php 3 years ago related-posts.php 8 years ago sample-element.php 4 years ago search.php 4 years ago socials-list.php 4 years ago staff.php 4 years ago tab-widget.php 4 years ago tabs.php 4 years ago testimonial.php 4 years ago text.php 3 years ago touch-slider.php 4 years ago video.php 4 years ago
sample-element.php
217 lines
1 <?php
2 /**
3 * Sample Element element
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2022 averta
11 */
12 /**
13 * http://docs.averta.net/display/ADD/Add+New+Element
14 */
15 function auxin_get_sample_master_array( $master_array ) {
16
17 $master_array['aux_sample'] = array( // the key should be same as 'base' param
18
19 'name' => __('Auxin Callout ', 'auxin-elements'), // [str] name of your shortcode for human reading inside element list
20 'auxin_output_callback' => 'auxin_widget_sample_callback', // [str] Name of widget function callback which will be defined after this array
21 'base' => 'aux_sample', // [str] shortcode tag. For [my_shortcode] shortcode base is my_shortcode
22 'description' => __('The element description', 'auxin-elements'), // [str] short description of your element, it will be visible in "Add element" window
23 'class' => 'aux-widget-sample', // [str] CSS class which will be added to the shortcode's content element in the page edit screen in Visual Composer backend edit mode.
24 'show_settings_on_create' => true, // [Boolean] set it to false if content element's settings page shouldn't open automatically after adding it to the stage
25 'weight' => 1, // [Int] content elements with greater weight will be rendered first in "Content Elements" grid, higher appear upper
26 'is_widget' => true, // whether to add widget not not
27 'is_shortcode' => true, // whether to add shortcode not not
28 'is_vc' => true, // whether to add the element to visual composer or not
29 'category' => THEME_NAME, // [str] category which best suites to describe functionality of this shortcode.
30 'group' => '', // [str] TODO: no idea Group your params in groups, they will be divided in tabs in the edit element window
31 'admin_enqueue_js' => '', // [str/arr] this js will be loaded in the js_composer edit mode
32 'admin_enqueue_css' => '', // [str/arr] absolute url to css file
33 'front_enqueue_js' => '', // [str/arr] to load custom js file in the frontend editing mode
34 'front_enqueue_css' => '', // [str/arr] to load custom css file in the frontend editing mode
35 'icon' => '', // URL or CSS class with icon image
36 'custom_markup' => '', // [str] custom html markup for representing shortcode in visual composer editor. This will replace visual composer element where shows the param and its value
37 'js_view' => '', // TODO: no idea Set custom backbone.js view controller for this content element there is a sample which sets it to
38 'html_template' => '', // it uses to override the output of shortcode. Path to shortcode template. This is useful if you want to reassign path of existing content elements lets say override the seprator defined by visual composer.
39 'deprecated' => '', // Enter version number of visual composer from which content element will be deprecated
40 'content_element' => '', // If set to false, content element will be hidden from "Add element" window. It is handy to use this param in pair with 'deprecated' param
41 'as_parent' => '', // use only|except attributes to limit child shortcodes (separate multiple values with comma)
42 'as_child' => '', // use only|except attributes to limit parent (separate multiple values with comma)
43 'params' => array( // array of all parameter
44 array( // array of a parameter
45 'param_name' => 'title', // [str] must be the same as your parameter name
46 'type' => 'textfield', // [str] attribute type
47 'value' => 'Sample Title', // [str/arr] default attribute's value
48 'holder' => 'textfield', // [str] HTML tag name where Visual Composer will store attribute value in Visual Composer edit mode
49 'class' => 'title', // [str] class name that will be added to the "holder" HTML tag. Useful if you want to target some CSS rules to specific items in the backend edit interface it also uses for widget param name it is better to be same as param name if you do not know what you are doing
50 'heading' => __('Title', 'auxin-elements'), // [str] human friendly title of your param. Will be visible in shortcode's edit screen
51 'description' => __('Description for this element', 'auxin-elements'),
52 'admin_label' => true, // [bool] show value of param in Visual Composer editor
53 'dependency' => '', // [arr] define param visibility depending on other field value
54 'weight' => '', // [int] params with greater weight will be rendered first
55 'group' => '' , // [str] use it to divide your params within groups (tabs)
56 'edit_field_class' => '' // [str] set param container width in content element edit window. According to Bootstrap logic eg. col-md-4. (Available from Visual Composer 4.0)
57 ),
58 array( // array of parameter
59 'param_name' => 'title2', // [str] must be the same as your parameter name
60 'type' => 'textfield', // [str] attribute type
61 'value' => 'Yes', // [str/arr] default attribute's value
62 'holder' => 'textfield', // [str] HTML tag name where Visual Composer will store attribute value in Visual Composer edit mode
63 'class' => 'title2', // [str] class name that will be added to the "holder" HTML tag. Useful if you want to target some CSS rules to specific items in the backend edit interface it also uses for widget param name it is better to be same as param name if you do not know what you are doing
64 'heading' => __('Title', 'auxin-elements'), // [str] human friendly title of your param. Will be visible in shortcode's edit screen
65 'description' => __('If you choose Callout a big box appears around the content', 'auxin-elements'),
66 'admin_label' => true, // [bool] show value of param in Visual Composer editor
67 'dependency' => '', // [arr] define param visibility depending on other field value
68 'weight' => '', // [int] params with greater weight will be rendered first
69 'group' => '' , // [str] use it to divide your params within groups (tabs)
70 'edit_field_class' => '' // [str] set param container width in content element edit window. According to Bootstrap logic eg. col-md-4. (Available from Visual Composer 4.0)
71 )
72 ),
73 'shortcode_atts' => array(
74 'size' => 100, // section size
75 'caption' => '',
76 'type' => 'callout', // callout, stunning
77 'bgcolor' => 'default', // #ffcc00
78 'btn_label' => '',
79 'btn_link' => '',
80 'title' => 'Sample Title', // section title
81 'target' => 'self', // button link target
82 )
83 );
84
85 return $master_array;
86 }
87
88 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_sample_master_array', 10, 1 );
89
90
91
92
93
94
95
96
97 /**
98 * Sample element markup for front-end
99 * In other words, the front-end output of this element is returned by the following function
100 *
101 * This is a sample element markup for an element.
102 * This function will be called via Master array mapper, so we need to tell
103 * the mapper about this function
104 */
105
106
107 /**
108 * Dynamic element with result in columns
109 * The front-end output of this element is returned by the following function
110 *
111 * @param array $atts The array containing the parsed values from shortcode
112 * containing widget info too
113 * @param string $shortcode_content The shorcode content
114 * @return string The output of element markup
115 */
116 function auxin_widget_sample_callback( $atts, $shortcode_content = null ){
117
118 // Defining default attributes
119 $default_atts = array(
120 'title' => '', // header title
121
122 'extra_classes' => '', // custom css class names for this element
123 'custom_el_id' => '', // custom id attribute for this element
124 'base_class' => 'aux-widget-sample' // base class name for container
125 );
126
127 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
128 extract( $result['parsed_atts'] );
129
130 // query --------------------------------------
131
132 // Create wp_query to get pages
133 $query_args = array(
134 'post_type' => 'page',
135 'orderby' => "menu_order date",
136 'order' => "DESC",
137 'post_status' => 'publish',
138 'posts_per_page' => -1,
139 'ignore_sticky_posts' => 1
140 );
141
142 $query_res = null;
143 $query_res = new WP_Query( $query_args );
144
145 ob_start();
146
147 // widget header ------------------------------
148 echo wp_kses_post( $result['widget_header'] );
149 echo wp_kses_post( $result['widget_title'] );
150
151 echo '<div class="aux-col-wrapper aux-col3">';
152
153 // widget custom output -----------------------
154
155
156 if( $query_res->have_posts() ): while ( $query_res->have_posts() ) : $query_res->the_post();
157 ?>
158
159 <article class="aux-col">
160 <!-- @TODO - The output for each element here -->
161 </article>
162
163 <?php
164 endwhile; endif;
165 wp_reset_query();
166
167
168 // widget footer ------------------------------
169 echo '</div><!-- aux-col-wrapper -->';
170 echo wp_kses_post( $result['widget_footer'] );
171
172 return ob_get_clean();
173 }
174
175
176
177
178
179 /**
180 * Element without loop and column
181 * The front-end output of this element is returned by the following function
182 *
183 * @param array $atts The array containing the parsed values from shortcode
184 * containing widget info too
185 * @param string $shortcode_content The shorcode content
186 * @return string The output of element markup
187 */
188 function auxin_widget_sample_callback2( $atts, $shortcode_content = null ){
189
190 // Defining default attributes
191 $default_atts = array(
192 'title' => '', // header title
193
194 'extra_classes' => '', // custom css class names for this element
195 'custom_el_id' => '', // custom id attribute for this element
196 'base_class' => 'aux-widget-sample' // base class name for container
197 );
198
199 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
200 extract( $result['parsed_atts'] );
201
202 ob_start();
203
204 // widget header ------------------------------
205 echo wp_kses_post( $result['widget_header'] );
206 echo wp_kses_post( $result['widget_title'] );
207
208 // widget custom output -----------------------
209
210
211
212 // widget footer ------------------------------
213 echo wp_kses_post( $result['widget_footer'] );
214
215 return ob_get_clean();
216 }
217