WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Select from gallery (4 posts)

  1. glennwelker
    Member
    Posted 5 years ago #

    I am currently working on a plugin that I would like to have store the location to an image in a database table. Ideally I would like to be able to use functionality already in WordPress to select the image from the gallery and then push its path to a custom form in the edit post area.

    Can anyone point me in the right direction of how I would use the image tools in WordPress to accomplish this?

  2. moonman239
    Member
    Posted 5 years ago #

    Let me try to understand your question. You want to make a plugin that stores an image location in a database table, and allows you to click on the image from the gallery and have it take you to a custom form in the edit post area? I suppose I could help. I'm not really an expert when it comes to creating a WordPress plugin, but I do Web programming. It sounds like the plugin maker (a WYSIWYG tool) does not allow you to create an image hyperlink. That's okay. Just go to the code editor and put to the left of <img src="your-image" height="your image height" width="your-image-width"> and to the right.

  3. moonman239
    Member
    Posted 5 years ago #

    Excuse me. I didn't know this forum would process the hyperlink. Anyway, here's the code to use: (add < before the a href): a href="http://www.your-blog.com/"<img src="your-image-url" height="your-image-height" width="your-image-width">

  4. glennwelker
    Member
    Posted 5 years ago #

    Thanks. I was really looking for a simple way to tie a single image to a post. I didn't want the image actually in the body of the post because I want to use it in different sections of my template.

    In the end, WordPress already does this. It creates an entry in the posts table for each image that you add while editing a post. I can get to the image later by querying the database an looking for an attachment with a parent of the postid.

    Thanks again.

Topic Closed

This topic has been closed to new replies.

About this Topic