• Resolved jonasschoen

    (@jonasschoen)


    Hi Anders,

    at first thank you very much for this and the many other great themes.

    I have one question: How can I change the URL of the site logo?

    I tried to use this sample code by another theme author but it doesn’t work for Chaplin. It would be nice if you could give me a quick hint.

    Thanks again and cheers,
    Jonas

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Theme Author Anders Norén

    (@anlino)

    Hi @jonasschoen,

    Glad you like them!

    Chaplin includes a custom function for outputting the logo (chaplin_get_custom_logo()), so in order to change the URL, you’d have to copy that function over to a child theme and modify the URL of the <a> element within the function.

    — Anders

    Thread Starter jonasschoen

    (@jonasschoen)

    Hi @anlino,

    thanks for your reply. I found this function before but nothing happens if I change the <a> element.

    I copied the “header.php” file to my child theme and only changed this line:
    $home_link_contents = '<a href="' . esc_url( home_url( '/' ) ) . '" rel="home">' . wp_kses_post( $site_title ) . '</a>';

    to this
    $home_link_contents = '<a href="https://my-custom-url.com">' . wp_kses_post( $site_title ) . '</a>';

    I don’t know if just oversee something. But I also understand that you can’t solve every problem, so I might just keep it the way it is.

    Cheers,
    Jonas

    Theme Author Anders Norén

    (@anlino)

    Hi @jonasschoen,

    That line (with the <a> tag) is only used when a logo isn’t set, and the site title is output as text.

    To modify the URL used in the logo, you’ll have to copy over the chaplin_get_custom_logo() function from the Chaplin functions.php file to your child theme functions.php file, and change the URL there.

    — Anders

    Thread Starter jonasschoen

    (@jonasschoen)

    Hi @anlino,

    I checked several times now but the chaplin_get_custom_logo() function only appears in the the header.php file. In the functions.php file is no such function.

    Cheers,
    Jonas

    Theme Author Anders Norén

    (@anlino)

    @jonasschoen Sorry, forgot I had restructured the functions file in Chaplin. You’ll find it parts/template-tags.php.

    Thread Starter jonasschoen

    (@jonasschoen)

    Thank you very much, Anders! Now it works.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Change URL of Site Logo’ is closed to new replies.