[wp-trac] [WordPress Trac] #33755: Add Site Logo to WordPress Core

WordPress Trac noreply at wordpress.org
Sat Feb 20 00:15:04 UTC 2016


#33755: Add Site Logo to WordPress Core
-------------------------------------------------+-------------------------
 Reporter:  fatmedia                             |       Owner:
     Type:  feature request                      |      Status:  reopened
 Priority:  normal                               |   Milestone:  4.5
Component:  Customize                            |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  ux-feedback has-patch needs-testing  |     Focuses:  ui
  needs-unit-tests has-screenshots               |
-------------------------------------------------+-------------------------

Comment (by westonruter):

 I'm not saying this is necessarily required for Site Logo, since the
 rendering logic in `the_site_logo()` is not very complicated, but I did
 want to mention that Selective Refresh (#27355) could be used here to
 preview changes to the Site Logo.

 Here is the code that could be added after adding the `site_logo` setting
 and control:

 {{{#!php
 <?php
 if ( isset( $this->selective_refresh ) ) {
         $this->selective_refresh->add_partial( 'site_logo', array(
                 'settings' => array( 'site_logo' ),
                 'selector' => '.site-logo-link',
                 'render_callback' => function() {
                         return get_the_site_logo(); // (Naturally add
 compat for PHP 5.2.)
                 },
                 'container_inclusive' => true,
         ) );
 }
 }}}

 By using Selective Refresh, the preview would be guaranteed to display any
 changes that maybe getting applied to the Site Logo via the
 `get_the_site_logo` filter.

 Something that this also provides is the ability to hover over the site
 logo to see a tooltip “Shift-click to edit this element”, which when
 clicking expands the Site Identity panel in the preview and focuses the
 image control. (See also #27403 for specifics on this UI.)

 I've implemented these [https://github.com/xwp/wordpress-
 develop/commit/5e9e133ead309dae4aff9a943487de60b5b3830b changes] in
 [attachment:33755.8.diff]. It also includes the “shift-click to edit”
 implementation even if selective refresh is not available.

 With these specific changes, the selective refresh will apply immediately
 after the JS-driven update. The duplicated JS preview logic ''could'' be
 removed and the site logo changes could continue to be seen. Nevertheless,
 having the preview logic implemented in both the JS and PHP would allow
 the JS update to serve a low-fidelity preview immediately, with a high-
 quality preview (with PHP filters applied) coming from the PHP-rendered
 selective refresh after the Ajax request returns.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33755#comment:72>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list