• Hi!

    I have begun playing with writing plugins and widgets and I have a problem…

    I want to create a plugin the let’s me link an image with a URL but this URL is generated using information I must fill in (ie or affiliate links and the like).

    I don’t know how to go about this…

    essentially I want to do something that let’s me do something like this

    <a href="bla bla bla"><img src="test.png"></a>

    “bla bla bla” is generated from information I must fill in and, hopefully, I would like to see be able the preview the image wrapped in this “link” in the visual editor…

    What should I look at to be able to do something like this? I don’t know what’s available in WordPress programming wise to do this…

    Thank you!

    Nick

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    If you want the image to appear in the visual editor, you might look at modifying the tinyMCE editor. Perhaps a toolbar button that is clicked when an image is selected that prompts for the link URL and wraps the image tag with the link. I’ve no experience modifying the editor but I know people do it all the time.

    Another possibility would be to alter the WP Media Library using jQuery to insert an additional field when inserting an image. The real trick would be to alter what HTML gets placed in the editor when the “Insert into Post” button is clicked. The form goes to an admin page, maybe there’s a filter there you can hook to achieve this. Worth further investigation?

    Sorry I can’t give you a specific path to follow. Hopefully my half baked ideas at least get you started in a direction.

    Thread Starter GuardianAngel

    (@guardianangel)

    Hi bcworkz!

    Sorry for the delayed reply…

    That definitely gave me a good idea of how I could do it, thank you!

    If I find any further information on this I will post back…

    Once again thank you!

    Nick

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom link for image?’ is closed to new replies.