Opened 10 years ago
Last modified 6 years ago
#31614 new enhancement
Add Actions to underscore media-template items
Reported by: | andrewgstreet | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description
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:
$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
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.
Attachments (3)
Change History (7)
This ticket was mentioned in Slack in #core-images by joemcgill. View the logs.
9 years ago
#3
@
9 years ago
Thanks for the ticket @andrewgstreet. I could see how it would be useful to modify the JS templates for embedded media items. I think the approach in #31281 might be a better holistic solution to this problem.
A sidenote: patches should be uploaded as SVN diffs. See this tutorial in the core handbook.
Suggested code modifcations