• Resolved postmanpott2

    (@postmanpott2)


    Hi,

    I am trying to have some text that switch to an image when expanded. I have tried using

    swaptitle=”img src=’url_to_image'” with ‘<‘ before img and ‘/>’ after the url

    and this show a preview of the image in wordpress, but not on the site. On the site the title text remains. Am I doing something wrong or is it not possible to do this?

    • This topic was modified 4 years, 5 months ago by postmanpott2.
    • This topic was modified 4 years, 5 months ago by postmanpott2.
    • This topic was modified 4 years, 5 months ago by postmanpott2.
    • This topic was modified 4 years, 5 months ago by postmanpott2.
    • This topic was modified 4 years, 5 months ago by postmanpott2.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author twinpictures

    (@twinpictures)

    [expand title="<img src='first_url'>" swaptitle="<img src='second_url'>"]Hidden Target Content[/expand]
    

    Be sure you are doing this while viewing in text mode and that the single and double quotes are NOT curly quotes.

    • This reply was modified 4 years, 5 months ago by twinpictures.
    Thread Starter postmanpott2

    (@postmanpott2)

    I am in text mode and I don’t know why the post I made have curly but I am using straight quotes in the command. Do you need the title to be an image aswell?

    Plugin Author twinpictures

    (@twinpictures)

    Can you post the full shortcode you are using? Please use the code wrapper in the WordPress Forum text editor so the code keeps its exact formating.

    Thread Starter postmanpott2

    (@postmanpott2)

    [expand title="VIEW SPECIFICATION" swaptitle="<img src="https://127.0.0.1/wp-content/files/arrow_up.png" />"]

    When i save changes the single quotes change to double

    • This reply was modified 4 years, 5 months ago by postmanpott2.
    • This reply was modified 4 years, 5 months ago by postmanpott2.
    Plugin Author twinpictures

    (@twinpictures)

    OK, the issue is you are using double quotes (“) for both the value of swaptitle, and the value of the src. This means that the value of the swaptitle will be interpreted as: <img src=. Notice the use of single quotes inside the double quotes:

    [expand title="VIEW SPECIFICATION" swaptitle="<img src='https://127.0.0.1/wp-content/files/arrow_up.png' />"]

    Thread Starter postmanpott2

    (@postmanpott2)

    When I copy and paste your code and then save, the quotes change to double when I look to edit it again.

    I even tried using the html character ' but wordpress just adds the double quote in this case.

    • This reply was modified 4 years, 5 months ago by postmanpott2.
    Thread Starter postmanpott2

    (@postmanpott2)

    I solved it, I had to edit the whole page as text and there use the single quotes, then wordpress doesn’t change it to double.

    Plugin Author twinpictures

    (@twinpictures)

    How are you creating the page? What entry method are you using?
    Standard WordPress Editor?
    A WordPress Gutenberg Block? (if so, which one?)
    A Visual Page Editor?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Image in swaptitle’ is closed to new replies.