• Resolved Mahrokh

    (@maahrokh)


    Hi,
    I need to add some SVG images as inline in block editor (for editing template or contents)
    How can I do such things without using plugins?

    I am editing my template using new block template

    Thank you

    • This topic was modified 1 year, 11 months ago by Mahrokh.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz

    (@bcworkz)

    You can place inline SVG into a Custom HTML block.

    Thread Starter Mahrokh

    (@maahrokh)

    @bcworkz

    Hi, Thank you for your reply and help
    Yes, But there isn’t any way to resize the image and change the color
    But we can do such things when we add SVG file as non inline

    • This reply was modified 1 year, 11 months ago by Mahrokh.
    Moderator bcworkz

    (@bcworkz)

    An external file referenced from an img tag is managed differently by a browser than an inline svg tag. You can manage a svg tag’s size by either altering its width and height attributes, or applying CSS transform: scale() to it.

    AFAIK the only way to change the color is to alter the inline code’s fill properties.

    Thread Starter Mahrokh

    (@maahrokh)

    @bcworkz

    Thank you , That resolved my problem ??

    In fact if the image is loaded via your template or function, with file_get_contents() function, the svg code will be added to your pages rendered HTML. Then you will be able to resize or color it with regular css properties :

    .my_inline_image_wrapper svg * {
    fill : red
    }

    Using it with ACF fields can make this image editable / reusable, etc.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘add inline SVG image into block editor’ is closed to new replies.