最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Custom Logo Link WordPress

programmeradmin3浏览0评论

I am trying to change the logo link of my wordpress website. But I am unable to achieve it. I am using child theme and using the code.

function crunchify_custom_logo_url ( $crunchify_logo_html ) {
 
    $crunchify_custom_logo_id = get_theme_mod( 'custom_logo' );
 
    // Make sure to replace your updated site URL
    $crunchify_new_url = '/';
 
    $crunchify_logo_html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
        esc_url( $crunchify_new_url ),
        wp_get_attachment_image( $crunchify_custom_logo_id, 'full', false, array(
            'class'    => 'custom-logo',
        ) )
    );
    return $crunchify_logo_html;
}
 
add_filter( 'get_custom_logo',  'crunchify_custom_logo_url' );

This code is not giving the error but its not working as it should. Any help where I am going wrong.

I am trying to change the logo link of my wordpress website. But I am unable to achieve it. I am using child theme and using the code.

function crunchify_custom_logo_url ( $crunchify_logo_html ) {
 
    $crunchify_custom_logo_id = get_theme_mod( 'custom_logo' );
 
    // Make sure to replace your updated site URL
    $crunchify_new_url = 'https://demystifytravel.com/home/';
 
    $crunchify_logo_html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
        esc_url( $crunchify_new_url ),
        wp_get_attachment_image( $crunchify_custom_logo_id, 'full', false, array(
            'class'    => 'custom-logo',
        ) )
    );
    return $crunchify_logo_html;
}
 
add_filter( 'get_custom_logo',  'crunchify_custom_logo_url' );

This code is not giving the error but its not working as it should. Any help where I am going wrong.

Share Improve this question asked Mar 6, 2022 at 15:35 Arbab AliArbab Ali 1
Add a comment  | 

1 Answer 1

Reset to default 0

Try to do some debugging, parent theme may be causing this issue, especially if your code is not showing errors.

Remove the parent filter get_custom_logo https://developer.wordpress.org/reference/functions/remove_filter/

If you filter works then it could be sign of priority issue.

$priority (int) (Optional) Used to specify the order in which the functions associated with a particular filter are executed. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the filter. Default value: 10

https://developer.wordpress.org/reference/functions/add_filter/

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论