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 / sample-element.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
sample-element.php
216 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-2026 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 'category' => THEME_NAME, // [str] category which best suites to describe functionality of this shortcode.
29 'group' => '', // [str] TODO: no idea Group your params in groups, they will be divided in tabs in the edit element window
30 'admin_enqueue_js' => '', // [str/arr] this js will be loaded in the js_composer edit mode
31 'admin_enqueue_css' => '', // [str/arr] absolute url to css file
32 'front_enqueue_js' => '', // [str/arr] to load custom js file in the frontend editing mode
33 'front_enqueue_css' => '', // [str/arr] to load custom css file in the frontend editing mode
34 'icon' => '', // URL or CSS class with icon image
35 '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
36 'js_view' => '', // TODO: no idea Set custom backbone.js view controller for this content element there is a sample which sets it to
37 '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.
38 'deprecated' => '', // Enter version number of visual composer from which content element will be deprecated
39 '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
40 'as_parent' => '', // use only|except attributes to limit child shortcodes (separate multiple values with comma)
41 'as_child' => '', // use only|except attributes to limit parent (separate multiple values with comma)
42 'params' => array( // array of all parameter
43 array( // array of a parameter
44 'param_name' => 'title', // [str] must be the same as your parameter name
45 'type' => 'textfield', // [str] attribute type
46 'value' => 'Sample Title', // [str/arr] default attribute's value
47 'holder' => 'textfield', // [str] HTML tag name where Visual Composer will store attribute value in Visual Composer edit mode
48 '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
49 'heading' => __('Title', 'auxin-elements'), // [str] human friendly title of your param. Will be visible in shortcode's edit screen
50 'description' => __('Description for this element', 'auxin-elements'),
51 'admin_label' => true, // [bool] show value of param in Visual Composer editor
52 'dependency' => '', // [arr] define param visibility depending on other field value
53 'weight' => '', // [int] params with greater weight will be rendered first
54 'group' => '' , // [str] use it to divide your params within groups (tabs)
55 '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)
56 ),
57 array( // array of parameter
58 'param_name' => 'title2', // [str] must be the same as your parameter name
59 'type' => 'textfield', // [str] attribute type
60 'value' => 'Yes', // [str/arr] default attribute's value
61 'holder' => 'textfield', // [str] HTML tag name where Visual Composer will store attribute value in Visual Composer edit mode
62 '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
63 'heading' => __('Title', 'auxin-elements'), // [str] human friendly title of your param. Will be visible in shortcode's edit screen
64 'description' => __('If you choose Callout a big box appears around the content', 'auxin-elements'),
65 'admin_label' => true, // [bool] show value of param in Visual Composer editor
66 'dependency' => '', // [arr] define param visibility depending on other field value
67 'weight' => '', // [int] params with greater weight will be rendered first
68 'group' => '' , // [str] use it to divide your params within groups (tabs)
69 '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)
70 )
71 ),
72 'shortcode_atts' => array(
73 'size' => 100, // section size
74 'caption' => '',
75 'type' => 'callout', // callout, stunning
76 'bgcolor' => 'default', // #ffcc00
77 'btn_label' => '',
78 'btn_link' => '',
79 'title' => 'Sample Title', // section title
80 'target' => 'self', // button link target
81 )
82 );
83
84 return $master_array;
85 }
86
87 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_sample_master_array', 10, 1 );
88
89
90
91
92
93
94
95
96 /**
97 * Sample element markup for front-end
98 * In other words, the front-end output of this element is returned by the following function
99 *
100 * This is a sample element markup for an element.
101 * This function will be called via Master array mapper, so we need to tell
102 * the mapper about this function
103 */
104
105
106 /**
107 * Dynamic element with result in columns
108 * The front-end output of this element is returned by the following function
109 *
110 * @param array $atts The array containing the parsed values from shortcode
111 * containing widget info too
112 * @param string $shortcode_content The shorcode content
113 * @return string The output of element markup
114 */
115 function auxin_widget_sample_callback( $atts, $shortcode_content = null ){
116
117 // Defining default attributes
118 $default_atts = array(
119 'title' => '', // header title
120
121 'extra_classes' => '', // custom css class names for this element
122 'custom_el_id' => '', // custom id attribute for this element
123 'base_class' => 'aux-widget-sample' // base class name for container
124 );
125
126 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
127 extract( $result['parsed_atts'] );
128
129 // query --------------------------------------
130
131 // Create wp_query to get pages
132 $query_args = array(
133 'post_type' => 'page',
134 'orderby' => "menu_order date",
135 'order' => "DESC",
136 'post_status' => 'publish',
137 'posts_per_page' => -1,
138 'ignore_sticky_posts' => 1
139 );
140
141 $query_res = null;
142 $query_res = new WP_Query( $query_args );
143
144 ob_start();
145
146 // widget header ------------------------------
147 echo wp_kses_post( $result['widget_header'] );
148 echo wp_kses_post( $result['widget_title'] );
149
150 echo '<div class="aux-col-wrapper aux-col3">';
151
152 // widget custom output -----------------------
153
154
155 if( $query_res->have_posts() ): while ( $query_res->have_posts() ) : $query_res->the_post();
156 ?>
157
158 <article class="aux-col">
159 <!-- @TODO - The output for each element here -->
160 </article>
161
162 <?php
163 endwhile; endif;
164 wp_reset_query();
165
166
167 // widget footer ------------------------------
168 echo '</div><!-- aux-col-wrapper -->';
169 echo wp_kses_post( $result['widget_footer'] );
170
171 return ob_get_clean();
172 }
173
174
175
176
177
178 /**
179 * Element without loop and column
180 * The front-end output of this element is returned by the following function
181 *
182 * @param array $atts The array containing the parsed values from shortcode
183 * containing widget info too
184 * @param string $shortcode_content The shorcode content
185 * @return string The output of element markup
186 */
187 function auxin_widget_sample_callback2( $atts, $shortcode_content = null ){
188
189 // Defining default attributes
190 $default_atts = array(
191 'title' => '', // header title
192
193 'extra_classes' => '', // custom css class names for this element
194 'custom_el_id' => '', // custom id attribute for this element
195 'base_class' => 'aux-widget-sample' // base class name for container
196 );
197
198 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
199 extract( $result['parsed_atts'] );
200
201 ob_start();
202
203 // widget header ------------------------------
204 echo wp_kses_post( $result['widget_header'] );
205 echo wp_kses_post( $result['widget_title'] );
206
207 // widget custom output -----------------------
208
209
210
211 // widget footer ------------------------------
212 echo wp_kses_post( $result['widget_footer'] );
213
214 return ob_get_clean();
215 }
216