wp/wordpress自定义小工具logo调用设置
在主题开发中,需要调用网站的logo,最简单的办法就是用wp自带的函数,那就是the_custom_logo(),使用它还可以通过后台-自定义-logo,边修改边预览,还是很香的,下面不多逼叨,上代码:
1.在functions.php中 ,添加
// 自定义logo
function themename_custom_logo_setup() {
$defaults = array(
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
);
add_theme_support( 'custom-logo', $defaults );
}
add_action( 'after_setup_theme', 'themename_custom_logo_setup' );
2.在需要位置调用
<?php the_custom_logo() ?>
修改上传logo的方法:后台——外观——自定义——logo
版权声明
本文仅代表作者观点,不代表博信信息网立场。
上一篇:css3的圆角边框属性是什么 下一篇:python如何在多个函数中使用一个变量