Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
get_custom_logo() - 返回链接到主页的自定义logo,除非主题支持删除主页链接 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / get_custom_logo()

get_custom_logo( int $blog_id )

返回链接到主页的自定义logo,除非主题支持删除主页链接


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "454f244433028bd9efcbe148a4e72acd" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "29ee66fe7549f2ae796e2579d52d0508" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

custom

logo


参数

$blog_id

(int) (可选) 相关博客的ID,默认值是当前博客的ID。


返回

(string) 自定义logo标签。



源码

查看源码 官方文档


更新日志

版本描述
5.5.1默认情况下,禁用了延迟加载
5.5.0添加了删除主页链接的选项,通过custom-logo主题功能的unlink-homepage-logo主题支持
4.5.0开始引入

使用示例

  • 示例1

    要获取自定义logo图像的URL:

    $custom_logo_id = get_theme_mod( 'custom_logo' );
    $image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
    echo $image[0];
    
  • 示例2
  • 示例3

    获取自定义logo图像URL的另一种方法:

    echo esc_url( wp_get_attachment_url( get_theme_mod( 'custom_logo' ) ) );