• Resolved Adrien L

    (@adrien-l)


    Hello folks!

    So, I’m trying to put some conditions on whether or not to display a header image. I would like a header to be shown on categories if it exists, or the category name otherwise.
    First, I had to remove the site-wise header, so that it isn’t returned as default.

    But, has_header_image() always returns true! The reason for that is that get_header_image() returns “https://remove-header” when the header is not set. I see this line of code on the get_header_image() function in wp-includes/theme.php:

    if ( 'remove-header' == $url )
        return false;

    So, I presume your plugin (or maybe another one) is insidiously adding ‘https://’ in front of this string, breaking this if statement.

    I’ll just add another if in my theme file for now, but maybe could you do something about it?

    Thanks anyway for a very good plugin!
    Adrien

    https://www.ads-software.com/plugins/unique-headers/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ryan Hellyer

    (@ryanhellyer)

    I’m busy working at the moment, but I can see that I escape the URL in the file inc/class-unique-headers-taxonomy-header-images.php. I wasn’t aware that could cause any problems, but it would possibly explain the addition of “https://” on the front if it’s escaping something which is not a URL.

    Perhaps try changing the line which says this in that file:
    return esc_url ( $url );

    and replace it with this:
    return $url;

    If that fixes your problem, please let me know and I’ll fix the official plugin to accommodate this issue.

    Plugin Author Ryan Hellyer

    (@ryanhellyer)

    Did the solution I suggested work?

    Plugin Author Ryan Hellyer

    (@ryanhellyer)

    The latest version of the plugin should fix this problem, so no need to follow the suggestion above now.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get_header_image() == "https://remove-header"’ is closed to new replies.