Home>Support>SVG Upload in Repeater

SVG Upload in Repeater

By roya, 8 years ago. Last reply by roya, 8 years ago.

Hi there,

I’ve added a new widget which will show a slider. For the slides I am using the repeater function, so every slide can be styled differntly.

I now want to upload svgs to every slide and show them to the frontend. So I’ve added the lines to the function to allow svg upload, but I just don’t know how to display the icon now?

I’ve tried:
$svgimageid = $repeater[‘icon’];
$svgimage= wp_get_attachment_image_src( $svgimageid );

A line like: <img src="”/> will only display the value “array”.

QUESTION:
– How can I now output the svg? It’s not working like a normal image.
– I’d like to insert the real SVG Code (not as an image element), so like opening the svg in the browser, right click “show sourcecode”. Is this possible?

Thank you!

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 29 days ago roya

    … can not edit it… sucks…

    Hi there,

    I’ve added a new widget which will show a slider. For the slides I am using the repeater function, so every slide can be styled differntly.

    I now want to upload svgs to every slide and show them to the frontend. So I’ve added the lines to the function to allow svg upload, but I just don’t know how to display the icon now?

    I’ve tried:

    $svgimageid = $repeater['icon'];
    $svgimage= wp_get_attachment_image_src( $svgimageid ); 

    A line like:

    <img src="<?php echo $svgimage; ?>"/>

    will only display the value “array”.

    QUESTION:
    – How can I now output the svg? It’s not working like a normal image.
    – I’d like to insert the real SVG Code (not as an image element), so like opening the svg in the browser, right click “show sourcecode”. Is this possible?

    Thank you!

  2. 8 years, 29 days ago roya

    so that was stupid….

    …. “array” should have been enough to recognize….

    thank you guys anyway.

    • 8 years, 29 days ago roya
      <img src="<?php echo $svgimage[0]; ?>"/>

      BTW: I really dislike that i cannot edit my posts. this thread could be 1 post with question AND answer … Think about it @siteorigin :) (and thank you for your work it’s awesome)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More