• Hi,
    i am trying to create a shortcode, where one can insert an image from the media library:

    <div id=”logo-sponsor”><div class=”grid-50″></div><div class=”grid-50″>{sponsor}</div></div>

    It consists of an image in the firts halb of the shortcode, which works fine. But the {sponsor} variable does not work. It gives this shortcode:

    [Logo+Sponsor sponsor=””]

    I am trying to click inside the “” and insert an image from the media library,
    but it does not show on front end.

    What am i doing wrong?

    Thanks in advance,
    Daniel

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi Daniel

    Testing this for you now!

    Kind regards
    David

    Hi Daniel

    Are you doing this in Visual or Text mode? Try Text, it more clearly shows you what you are doing. I can click inside the “”. But WordPress will add a fill image tag, not just the URL. I would otherwise suggest to also add the image code in the shortcode, and only add the url in the variable.

    https://monosnap.com/file/NdPo79lJdFMG3bZxyjxhIkq9UzZAfP.png

    Does that help? Let me know!

    Kind regards
    David

    Thread Starter Daniel Letschka

    (@dinonid)

    Hi David,

    thanks for your answer!

    I tried this in textmode. Something strange happened:

    When i insert an image from the media library that has a caption, the image with the caption ist shown in the frontend. But in a broken way (image with cation tags around it)

    Code:

    [Logo+Sponsor sponsor=”[caption id="attachment_32490" align="alignnone" width="150"] .[/caption]“]

    If i delete the caption the code looks like this, but the image is not shown in the frontend:

    [Logo+Sponsor sponsor=”“]

    I am aware of the solution, that i could only insert the image-link. But as it’s a site for a client, it would be nice if inserting an image would just work.

    Any ideas?

    Thanks again,
    Daniel

    Hi Daniel

    I can’t think of a good workaround at the moment.

    Are the images always different? Dynamic? Or always the same?

    Kind regards
    David

    Thread Starter Daniel Letschka

    (@dinonid)

    Hi David,

    yes the images are always different. It’s for a client. But it seems, he has to copy in the imagelink if there’s no other option.
    But that should be fine, too. It’s just not as comfortable.

    Thx,
    Daniel

    Hi Daniel

    Yes, looks like that, especially if the images are always different…

    Kind regards
    David

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Insert Images’ is closed to new replies.