• 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)
  • You can alter the gallery shortcode. See this. Look through /wp-includes/media.php til you find add_shortcode('gallery', 'gallery_shortcode'). Add this to functions file, rename ‘gallery_shortcode’, and add your new options to the $atts = shortcode_atts( … array. Then, add how to display those the the output.

    Then add:
    remove_shortcode('gallery', 'gallery_shortcode');
    add_shortcode('gallery', 'gallery_shortcode_yournewname');

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.