简体   繁体   English

wordpress customizr 主题显示徽标和标题

[英]wordpress customizr theme show logo and title

I am using customizr theme, I want to show both a logo and a title in header part.我正在使用 customizr 主题,我想在标题部分显示徽标和标题。 but I can show only one item at a time.但我一次只能显示一项。 as per this documentation http://www.themesandco.com/customizr/ theme set title if there is no logo.如果没有徽标,则根据此文档http://www.themesandco.com/customizr/主题设置标题。 I want to show both, is there any way for this ?我想同时展示两者,有什么办法吗? I want to show logo and on left side a company name.我想在左侧显示徽标和公司名称。 plz help请帮忙

you can use a the *__after_logo* hook with the following code.您可以使用带有以下代码的 *__after_logo* 钩子。 (to copy and paste in your functions.php file of your child theme or your theme). (复制并粘贴到您的子主题或主题的functions.php 文件中)。

add_action( '__after_logo' , 'display_my_site_title');
function display_my_site_title() {
    //first checks if there is a logo uploaded
    $logo_src               = esc_url ( tc__f( '__get_option' , 'tc_logo_upload') ) ;
    if ( empty($logo_src) ) 
        return;

   //then print the site title after
    printf('<h1><a class="site-title" href="%1$s" title="%2$s | %3$s">%4$s</a></h1>',
        esc_url( home_url( '/' ) ),
        esc_attr( get_bloginfo( 'name') ),
        esc_attr( get_bloginfo( 'description' ) ),
        esc_attr( get_bloginfo( 'name') )
    );
}

The code has been tested and works.该代码已经过测试并且可以正常工作。 (you have to have at least v3.0.14 of the theme) (你必须至少有 v3.0.14 的主题)

I hope this will be useful.我希望这会很有用。

You will need to adjust the following file:您将需要调整以下文件:

customizr\\parts\\class-header-header_main.php customizr\\parts\\class-header-header_main.php

You're right that it will show the title or the logo, as per comment in the file:根据文件中的评论,它会显示标题或徽标是对的:

LINE 115 The template for displaying the title or the logo LINE 115 显示标题或标志的模板

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM