^ 回到顶部
  • 人生没有定律,每个人都有自己的节奏
  • 本站wordpress建站教程均通过实践后发布,希望对你有帮助
  • 希望你的坚持,都是因为热爱,而不是因为不甘心
  • 8年wordpress建站经验,5星服务品质
  • 那些不愿意让你吃亏的人,才是真正值得你深交的人,也是值得你付出时间的人
  • 阿里云2核2g仅需86元/年

wordpress函数has_custom_logo()用法示例

has_custom_logo( int $blog_id )

Determines whether the site has a custom logo.


描述


参数

$blog_id

(int)
(Optional)
ID of the blog in question. Default is the ID of the current blog.

新用户2核2g仅需86元/年    领取1153套模板    免费cdn流量包    ¥3188礼包


返回值

(bool) Whether the site has a custom logo or not.


源代码

File: wp-includes/general-template.php

function has_custom_logo( $blog_id = 0 ) {
	$switched_blog = false;

	if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
		switch_to_blog( $blog_id );
		$switched_blog = true;
	}

	$custom_logo_id = get_theme_mod( 'custom_logo' );

	if ( $switched_blog ) {
		restore_current_blog();
	}

	return (bool) $custom_logo_id;
}

更新日志

Version 描述
4.5.0 Introduced.

相关函数

Uses

  • wp-includes/theme.php:
    get_theme_mod()
  • wp-includes/load.php:
    is_multisite()
  • wp-includes/load.php:
    get_current_blog_id()
  • wp-includes/ms-blogs.php:
    switch_to_blog()
  • wp-includes/ms-blogs.php:
    restore_current_blog()

Used By

  • wp-includes/post-template.php:
    get_body_class()

  1. Skip to note content

    You must log in to vote on the helpfulness of this noteVote results for this note: 1You must log in to vote on the helpfulness of this note

    Contributed by Anthony Hortin

    See Also
    the_custom_logo()
    get_custom_logo()

  2. To get the URL of the custom logo image:

    
    $custom_logo_id = get_theme_mod( 'custom_logo' );
    $image = wp_get_attachment_image_src( $custom_logo_id , 'full' );
    echo $image[0];
    

让小雨知道,这篇文章帮到了你
扫码关注微信公众号zs40086(微搜片)随时随地微信看片,抢先福利电影等你来

热门推荐

如有疑问,请前往问答中心反馈!

反馈