您可以使用get_custom_logo 过滤器可根据需要自定义自定义徽标的HTML。例如,您可以这样做:
您可以进一步使用wp_get_attachment_image_attributes 筛选以获取图像src 徽标的。问题是如何使用它。下面的示例代码使用一个类将图像源存储为属性,以便可以在其他过滤器中使用。
namespace WordPress\\StackExchange;
class logo {
  protected $src = \'\';
  public function init() {
    \\add_filter( \'wp_get_attachment_image_attributes\', [ $this, \'img_atts\' ] , 10, 3 );
    \\add_filter( \'get_custom_logo\', [ $this, \'wpse_custom_logo\' ], 10, 2 );
  }
  public function image_atts( $attr, $attachment, $size ) {
    if( \'custom-logo\' ]=== $attr[ \'class\' ]  ) {
      $this->src = $attr[ \'src\' ];
    }
    return $attr;
  }
  public function wpse_custom_logo( $html, $blog_id ) {
    return sprintf( \'
      <div class="logo">
        <a id="logo" href="#" data-height="110" data-padding="0">
          <img class="logo-main scale-with-grid" src="%1$s" data-retina="%2$s" data-height="209" alt="animals2">
          <img class="logo-sticky scale-with-grid" src="%1$s" data-retina="%2$s" data-height="209" alt="animals2">
          <img class="logo-mobile scale-with-grid" src="%1$s" data-retina="%2$s" data-height="209" alt="animals2">
          <img class="logo-mobile-sticky scale-with-grid" src="%1$s" data-retina="%2$s" data-height="209" alt="animals2">
        </a>
      </div>\',
    \\esc_url( $this->src ),
    \\esc_url( get_template_directory_uri() . \'/content/animals2/images/retina-animals2.png )\'
    );
  }
}
\\add_action( \'init\', [ new logo(), \'init\' ] );
 这将包含在您的功能中。php。尽管如此,由于这4幅图像都是相同的,可能有更好的方法来实现这一点。