PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Link uploaded Image to created Post

  1. Jenne
    Member

    Hey GF team,
    Great plugin and good Support Forum. I found out about most of the problems till here:

    My Form allows uploading a since picture(+ various other fields of course) and is published instantly after submitting.

    I tried to link the image to the newly created post but that wasn´t successful using the merge tags.

    This is what i thought would work:
    <center>{Bild:3:large}

    Also the entry_URL is not the right tag because its going to /wp-admin/.
    I can´t use the entry_id or entry_titel to append my domain etc to it because my permalink-structure from wordpress is http://www.homepage.com/%post_id%/%category%/%postname%/

    Is there anyway i can link the uploaded image to the post (without opening it in a new window of course)

    Thanks in advance

    Posted 6 years ago on Thursday September 20, 2012 | Permalink
  2. Jenne
    Member

    sorry forgot the code tags
    This is how i tried it without success

    <center><a href="{entry_id}">{Bild:3:large}
    
    <!--more-->
    Posted 6 years ago on Thursday September 20, 2012 | Permalink
  3. Jenne
    Member

    Hey Supporters,
    guess i waited an "adequate time" for response now ... ;-)

    Posted 6 years ago on Saturday October 13, 2012 | Permalink
  4. Sorry for the delay. This one fell through the cracks.

    You don't want the entry URL but the post URL or post ID. You can always use the Page or Post ID in your link: it will be converted by WordPress. For example, try this link:

    http://gravity.chrishajer.com/?page_id=913

    It will be rewritten and the pretty permalink will be shown in the address bar.

    Try it like this:

    [php]
    <center><a href="{post_id}">{Bild:3:large}</a></center>
    
    <!--more-->

    You want to send people to the post they just created, not the admin entry screen.

    Posted 6 years ago on Thursday October 25, 2012 | Permalink
  5. Jenne
    Member

    Hey Chris, thanks for your reply.
    But that did not work. It looks like it ignored the post_id.

    When the template looks like:
    <center><a href="{post_id}">{Bild:3:large}</a><center>

    The generated posthtml is:

    <a href=""> <img ....

    found a hint at another forum to add p= in front of post_id
    <center><a href="p={post_id}">{Bild:3:large}</a><center>
    but it leads to this html:

    <a href="p="><img ....

    any other idea about that?

    Posted 6 years ago on Friday October 26, 2012 | Permalink
  6. Jenne
    Member

    Bump for a solution...

    Posted 6 years ago on Friday November 2, 2012 | Permalink
  7. Jenne
    Member

    Bump again :-/

    Posted 6 years ago on Monday November 5, 2012 | Permalink
  8. Jenne
    Member

    Is it really that hard to link that [*******] image to the post created? As far as i can judge this the postid isn´t known when the above solution is processed so i guess i have to use tghat post-processing i read about. but i have exactly no idea what hooks etc i have to use to get this working. I can´t be the only one who uses images that should be linked to the full post?

    Posted 6 years ago on Friday November 9, 2012 | Permalink
  9. Jenne
    Member

    Sorry but that is not what i would call support -.-

    Posted 6 years ago on Tuesday November 13, 2012 | Permalink
  10. Jenne, please send me an email at chris@rocketgenius.com with a WordPress administrator login and I will take a look at this for you.

    Posted 6 years ago on Tuesday November 13, 2012 | Permalink
  11. This was more difficult than I expected it to be. I created a function and shortcode to grab the first image attachment on a post. The code for this shortcode and function can be found here: http://pastebin.com/H08pMz1P

    I added that code to your theme's functions.php file (at the bottom.)

    Then I changed your content template. I removed the merge tag for the post image which is being uploaded, and replaced it with [gf_postimage] which will call this new function. The function will return the image tag and the link to the parent post. I created one test post and the functionality works. I emailed you as well. Please let us know if you have any questions.

    Posted 6 years ago on Sunday November 18, 2012 | Permalink
  12. Jenne
    Member

    And it works perfectly. :-)
    Thank you Chris for your personal dedication to my issue.Probably you could include that thig into the standard edition because i don´t think i am the only one who wants to link pics to full posts .

    Great work :-)

    Posted 6 years ago on Sunday November 18, 2012 | Permalink
  13. You're welcome. As I explained in my email, it's a bit of a catch 22 since you don't have the post ID before you create the post, so inserting the shortcode into the post body is probably the way to go. I'm surprised it has NOT come up more often. We'll explore other options if it becomes an issue for more people.

    Posted 6 years ago on Sunday November 18, 2012 | Permalink

This topic has been resolved and has been closed to new replies.