This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

SVG Upload in Repeater

9 years ago · Last reply by roya 9 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.

Need fast email support? Get SiteOrigin Premium

Replies

3
  1. roya 9 years, 5 months ago

    … 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. roya 9 years, 5 months ago

    so that was stupid….

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

    thank you guys anyway.

    • roya 9 years, 5 months ago
      <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.

Have a different question or issue?

Start New Thread