I want to create a page on my blog, where users can pick an image (WordPress attachment) from my blog and send it to a friend using a URL generated.
For example, if they want to send a picture on my blog, wrapped in an image frame, then they will be able to select any image from my blog (there will be an option on each post to send the image so that the attachment ID can be grabbed from that post), and then they will be able to enter their name and generate a link which will contain the name and attachment id as parameters.
After that when the link is clicked, a page will open where the image whose attachment ID is given in the url will be loaded along with the name present in the URL.
Can anyone help?
Sounds pretty much like the link to open a larger image on a new page that is one of the standard attachment options. Except the user copies the link and sends it to a friend instead of clicking on it.
You should start with that built in functionality and extend it to make it more user friendly and incorporate you extra data.
I meant that users will be able to generate a link by clicking a button, suppose in which their name is attached, and then wen the user sends it to another user, and when he/she opens the links, there will be page where the image whose attachment ID is included in the URL will be opened within an image frame with the name attached to it.
Something like this, http://thewordpresswarrior.com/616/passing-variables-via-url but here instead of passing data to a form, I want to use the data passed to display an image from my blog as well as some text.
I understand. I’m suggesting you use the built in functionality for image attachments as a way for the friend to view the image in a frame, with your elements added in. If you still need this functionality as is, you can at least use it for inspiration for your own new functionality. You could also use the rewrite API for implementing more elegant permalink like link.
How is the link sent to the friend. User cut/pastes to his messaging method of choice? E-mail from your server? Open the user’s default e-mail with link already in body? Offer several options?
Finally, edit a copy of the content-image.php template to grab the data attached to the URL and display it in the correct place on the page.
All this is too much to get into any detail. You also have a few design decisions to make on exactly the best way to implement each detail. I suggest starting with something basic, like clicking a button that displays just the image attachment link. Then start adding more functionality, one small step at a time. If you get stuck anywhere, come back here with a specific, detailed question. Right now, your question is too broad and general to answer with any more detail than I have right now.
- The topic ‘Using URL Parameters in WordPress’ is closed to new replies.