Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- / Unhook default Thematic functions
- function unhook_thematic_functions() {
- remove_action( ‘print_media_templates’, ‘td_change_backbone_js_hook’);
- add_action(‘print_media_templates’, ‘custom_td_change_backbone_js_hook’);
- }
- add_action( ‘init’, ‘unhook_thematic_functions’ );
- /**
- * custom gallery setting
- */
- function custom_td_custom_gallery_settings_hook () {
- // define your backbone template;
- // the “tmpl-” prefix is required,
- // and your input field should have a data-setting attribute
- // matching the shortcode name
- ?>
- <script type=”text/html” id=”tmpl-td-custom-gallery-setting”>
- <label class=”setting”>
- <span>Gallery Type</span>
- <select data-setting=”td_select_gallery_slide”>
- <option value=”slide”>TagDiv Slide Gallery</option>
- <option value=””>Default </option>
- </select>
- </label>
- <label class=”setting”>
- <span>Gallery Title</span>
- <input type=”text” value=”” data-setting=”td_gallery_title_input” />
- </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, {
- td_select_gallery_slide: ”, td_gallery_title_input: ”
- });
- // 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(‘td-custom-gallery-setting’)(view);
- }
- });
- //console.log();
- // wp.media.model.Attachments.trigger(‘change’)
- });
- </script>
- <?php
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment