Support » Plugin: GenerateBlocks » Custom button icons

  • Resolved Pradeep

    (@pmaheepala)


    Hello there,

    Could someone kindly explain if it’s possible to use our own SVGs as button icons? Yes I am aware of the icon HTML field but so far I’ve not had much luck with that. I have this image of an arrow provided by a client in SVG format which I am trying to add as a button icon. I tried by opening the SVG file using an XML editor (VS Code), and then copying everything within SVG tags.

    Any help is highly appreciated.

    Best regards,

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tom

    (@edge22)

    Hi there,

    You need to copy the entire SVG HTML, including the <svg></svg> tags.

    Also, be sure to optimize the SVG first so it’s nice and clean: https://jakearchibald.github.io/svgomg/

    Let us know if you need more info 🙂

    Thread Starter Pradeep

    (@pmaheepala)

    Hello Tom,

    Thanks for the quick and prompt reply.

    I gave it another try but it didn’t work I’m afraid. I wonder if it’s something to do with this particular ‘format’ of the SVG I am trying to add, as a different SVG file I’ve tried worked fine. This is an SVG I’ve exported from a Figma design and here’s the cleaned version of it. Many thanks for that SVG optimiser by the way.

    <svg width="12" height="8" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path fill="url(#pattern0)" d="M0 0h12v7.633H0z"/><mask id="a" maskUnits="userSpaceOnUse" x="0" y="0" width="12" height="8"><path fill="url(#pattern1)" d="M0 0h12v7.633H0z"/></mask><g mask="url(#a)"><path fill="#000" fill-opacity=".65" d="M0 0h12v7.633H0z"/></g><defs><pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1"><use xlink:href="#image0" transform="scale(.00278 .00437)"/></pattern><pattern id="pattern1" patternContentUnits="objectBoundingBox" width="1" height="1"><use xlink:href="#image0" transform="scale(.00278 .00437)"/></pattern><image id="image0" width="360" height="229" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAWgAAADlCAYAAAB+vG1nAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAAB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b7v9nVgHmlYAEJFAUAeR8GHE7kTlsuF/UrrAYCUggnQBGXkCszTQzuW24n74TLEACEiiKAGKcS9yQLGcb7he1KyxGAhIoggBivjZZzjbcL2InWIQEJFAUAcS8JlnOkd6G+0XtCouRgATSCSDGFUTcWsgcNtxP3wkWIAEJFEcAK9+caWZy23C/uF1hQRKQQDoB5HhCspyvTYfQ4wL8oEqPF9epVUHgjYmzvIHcf5CYv/epFXTvl9gJ9pzAaUnzW0fei/kI9+6k/FWkVdBVLLOT7DGBX06Y2wZy/hZy3pGQu6qUCrqq5XayPSTwvJbn9C3yvQE5P9Fy3irTKegql91J94jArhbn8m1yvQ45b2sxZ9WpFHTVy+/ke0Ag2nm2MaLhfrQN3dJGMnP8jICCdidIoNsE7m6hfBvutwB5phQKeiYqPieB7hDYOOZSbbg/ZsBeXgIS6CkBPqSyhHhqTB9W2cp1T+kpuk5My3fQnVgmi5TAzAS4JxzvcK+f+dWRnn2Ms1/P9f9tpKt4sgQkIIGaCfAudynxWIPvoqPh/nk1M3XuEpCABBojgFD/sCFBR1e8NzVWmBeSgAQkIIE5cxDr344o6ZDzW2UpAQlIQAJjIIBg/5TYcQii3sw53tYYw5p4SQlIQAL7CCDalcRtQ0o67jd/nFiy7wI+KIbARDGVWIgEJNAoAaS7ggteRJxJnERE346dxAPEJmI9cePevwThoaM0Av8HcYJwNpY496IAAAAASUVORK5CYII="/></defs></svg>

    If we can’t get it to work, is there any way that we can add a PNG image?

    Many thanks and regards,

    Pradeep

    Plugin Author Tom

    (@edge22)

    That’s likely the issue – it’s an encoded image, not a regular SVG file. The SVG field is sanitized for security reasons, which is likely why the above isn’t working.

    It won’t accept a PNG, but you can try an inline image, which is a core WP feature in the block toolbar dropdown.

    Alternatively, I would just have the image converted to an actual SVG.

    Thread Starter Pradeep

    (@pmaheepala)

    Many thanks for the reply and the tips Tom! Keep up the great work.

    Plugin Author Tom

    (@edge22)

    No problem! Thanks! 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom button icons’ is closed to new replies.