wp/wordpress自定义小工具logo调用设置
七娃博客1,193人阅读
在主题开发中,需要调用网站的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
评论 | 0 条评论
登录之后才可留言,前往登录