[wp-trac] [WordPress Trac] #31614: Add Actions to underscore media-template items

WordPress Trac noreply at wordpress.org
Thu Mar 12 17:01:59 UTC 2015


#31614: Add Actions to underscore media-template items
---------------------------+-----------------------------
 Reporter:  andrewgstreet  |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Media          |    Version:  trunk
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 Currently, there is no way to override the underscore templates used in
 media-template.php. It would great if each template item was preceded by a
 conditional such that:

 {{{#!php
    $result = do_action('tmpl-attachment'); //template name as action
    if (isset($result) && $result !== false) {
    ?>

    <script type="text/html" id="tmpl-attachment">
    <!-- Existing Template Here -->
    </script>

    <?php }
 }}}

 Then it would be easy to duplicate the existing template for modification

 {{{#!php
    function my_custom_media_attachment_template() {
     ?>
     <script type="text/html" id="tmpl-attachment">
         <!-- My Custom Template Goes Here -->
     </script>
     <?php
     return false;
    }
    add_action("tmpl-attachment", my_custom_media_attachment_template);
 }}}


 For my current project I'm having to do it, which of course means hacking
 the WP core. I'd be happy to share.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31614>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list