Remove image in header

  • carthagod

    #4754

    Hello,

    I want to use a transparent image for my header,and since the upload converts the file in png I did this through custom css :

    #header {
    background-image:url(...)!important;}

    Works fine, however I am left with a with an empty src in the header, which for one this is not good coding practice, and more importantly displays a blue question mark on Android browser.

    How can I get rid of the img tag ? I don’t have much knowledge of php and how a theme works.

    Thanks !

    Thomas

    PS : I’m using a child theme (only installed it though, doesn’t do anything yet), maybe a line of code in the function.php to strip out this tag ?

    carthagod

    #29083

    PS: website is http://scuba-college.eu. If you try it now on Android you won’t see the question mark, cause I temporarely solved the problem by putting a fake header image and apply “display:none” to it through custom css. Not a very clean solution though, so I would prefer to completely remove the img tab

    Anonymous

    #29084

    .png’s can be transparent.

    Are you creating the image yourself?

    carthagod

    #29085

    Sorry, didn’t see your answer. I know .png can be transparent, that’s why I use it as a background image for my header.

    Anyone knows how to remove the default img tag in the header ?

    Anonymous

    #29086

    Copy the header.php file to your child theme and modify it to your preferences.

    carthagod

    #29087

    Yes, this is actually what I am doing at this precise minute 🙂

    However this means that when the theme updates, I will not get the uptades of the header section if they are any correct ?

    Anonymous

    #29088

    That is correct. You can keep an eye on the themes changelog to see if any modifications where made to the header file.

    Also, if you want to be VERY precise, you can download a program which will compare two files and note the differences. I forget the name of it, but I’m sure you can find one if you search around.

    Then, compare the new header.php of the new version to your current one before installing the update. Overkill… but this will ensure you are kept current with your header.php file.

    Anonymous

    #29089

    Why can’t you just remove graphene_header action or graphene_header_image filter using a child theme?

    Or am I missing something??

    carthagod

    #29090

    Yes, this is what I did for now. However, as we are discussing it with Ken, this means that I will not get the updates for the header if they are any, as I will be using my own header.php file in my child theme.

    As Ken suggests I could check the new versions for any change, but that’s a lot of hassle for one thing, and for the other I’m doing this site for someone else who will not be able to do so.

    So my best bet would be to add a function in function.php that strips the image in the header, but I don’t know enough php to do this, so I’m asking if you know what function I can write.

    Hope this makes my request more clear, thanks for your patience 🙂

    Admin

    Syahir Hakim

    #29091

    I think what Prasanna meant was that you can just use the graphene_header_image filter hook to replace the header image with your own image, bypassing the WordPress Custom Header feature completely.

    In your child theme’s functions.php file:

    function graphene_custom_header_img(){
    return 'http://path.to/image/file';
    }
    add_filter( 'graphene_header_image', 'graphene_custom_header_img' );

Viewing 10 posts - 1 through 10 (of 15 total)

  • 1
  • 2
  • You must be logged in to reply to this topic.