[wp-trac] [WordPress Trac] #35524: Overwrite default widget templates

WordPress Trac noreply at wordpress.org
Tue Jan 19 10:02:21 UTC 2016


#35524: Overwrite default widget templates
------------------------------+-----------------------------
 Reporter:  sebastian.pisula  |      Owner:
     Type:  enhancement       |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Widgets           |    Version:
 Severity:  normal            |   Keywords:
  Focuses:                    |
------------------------------+-----------------------------
 I have two proposal for layout in default widget. I think that developer
 should have possibility to overwrite widget layout. I suggest value of
 widget method add to new directory: wp-includes/widget-templates and add
 if:

 {{{#!php
 <?php
 public function widget( $args, $instance ) {

                 $widget_template = 'widget-templates/recent-posts.php';

                 if ( $template = locate_template( $widget_template ) ) {
                         include $template;
                 } else {
                         include ABSPATH . WPINC . '/' . $widget_template;
                 }
         }
 }}}

 Developer can overwrite widget layout in theme.

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


More information about the wp-trac mailing list