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