How to get value of my custom gallery setting and display it on frontend
-
Hi with this snippet i created additional fields to gallery settings:
[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
<script type="text/html" id="tmpl-slideshow-gallery-settings"> <label class="setting"> <span><?php _e('Display'); ?></span> <select data-setting="slideshow_attr"> <option value="default"> Default gallery </option> <option value="zzlslideshow"> Slideshow </option> <option value="masonry"> Masonry gallery </option> </select> </label> <label class="setting"> <span><?php _e('imgwidth'); ?></span> <input type="text" value="" data-setting="imgwidth_text" style="float:left;"> </label> <label class="setting"> <span><?php _e('imgheight'); ?></span> <input type="text" value="" data-setting="imgheight_text" style="float:left;"> </label> </script> <script> jQuery(document).ready(function(){ // add your shortcode attribute and its default value to the // gallery settings list; $.extend should work as well... _.extend(wp.media.gallery.defaults, { slideshow_attr: 'zzlslideshow' }); // merge default gallery settings template with yours wp.media.view.Settings.Gallery = wp.media.view.Settings.Gallery.extend({ template: function(view){ return wp.media.template('gallery-settings')(view) + wp.media.template('slideshow-gallery-settings')(view); } }); }); </script>
But now i could use some help. How can i get the chosen values and display them on frontend. For example: if option: zzlslidehow is chosen i want in frontend flexslider2 displayed. Can anyone tell me how to do so
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to get value of my custom gallery setting and display it on frontend’ is closed to new replies.