• Resolved asmaloney

    (@asmaloney)


    I would like to use an SVG image as my header.

    I installed the SVG Support plugin and can get the image into my media library, but when I try to use it in the header (Header Image section) it errors out trying to crop it (it simply says “There has been an error cropping your image.”).

    What do I need to do to get this to work with this theme?

    Thank you for your time!

    – Andy

    P.S. Thank you for this theme! I think it’s almost perfect for the non-profit I’m doing this site for.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hey @asmaloney,

    This might help send you in the right direction:
    https://thebrandid.com/using-svg-logos-wordpress-customizer/

    Thread Starter asmaloney

    (@asmaloney)

    Thanks for the lightning-quick reply!

    I see in that post that they are modifying the theme – I was hoping not to have to do that…

    Oh hey – you’re the SVG Support plugin guy – thanks for that!

    No problem ??

    Yeah, unfortunately it’s something that will likely be unique to each theme.

    Thread Starter asmaloney

    (@asmaloney)

    If anybody runs into this in the future, I solved it by creating a simple plugin which hooks into the after_setup_theme action and adds a modified version of the add_theme_support call from the post @benbodhi mentioned.

    This way the theme does not need to be modified at all…

    Thanks for your feedback.
    Curious, wouldn’t each theme’s dimensions be unique anyway so you’d have to edit the plugin for each theme? Or did you write it so it pulls data from the active theme?

    • This reply was modified 7 years, 9 months ago by Benbodhi.

    Ha! Tried to mark as resolved, this is not my thread to mark as resolved haha.

    • This reply was modified 7 years, 9 months ago by Benbodhi.
    Thread Starter asmaloney

    (@asmaloney)

    ??

    Nope – I just made a plugin for my own site because as you point out it’s custom. For this theme (xMag) all I did was:

    
    add_action( 'after_setup_theme', 'asm_allow_svg_header' );
    
    function asm_allow_svg_header()
    {
      add_theme_support( 'custom-header', array(
        'flex-height'    => true,
        'flex-width'    => true,
      ) );
    }
    

    (Aside: I usually have a custom plugin for each site where I do this kind of tweaking of the theme/layout/etc., so this fits well with that model.)

    Hmmmm, I wonder if it would be worth including something generic like that in my plugin to work with themes out of the box… I’ll ponder. Thank you ??

    Thread Starter asmaloney

    (@asmaloney)

    I was going to ask you about that but figured it was probably beyond the scope of your plugin. Would be great to have though! Thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘SVG As Header Image’ is closed to new replies.