WordPress.org

Ready to get started?Download WordPress

Forums

Pin It On Pinterest
Pin Button Disappears After Editing Post (5 posts)

  1. oceanwidedesigns
    Member
    Posted 2 years ago #

    I noticed that after I edit a post, the Pin button forgets the image that was attached to it... so then the button disappears from the post. I have to re-edit and reselect the photo to get the button to reappear.

    Also wondering if the plugin could allow for customization of location of the button... I would really like to have it appear under my Twitter & Facebook plugins at the top of my post from the Socialize plugin by Shareaholic.

    http://wordpress.org/extend/plugins/pin-it-on-pinterest/

  2. FolioVision
    Member
    Posted 2 years ago #

    Hello,

    I'm noticing the same issue.

    Please add a check if $_REQUEST['pin_image'] is defined in Pinterest::save_pin_options before saving it!

    Thanks,
    Martin

  3. Peachyme
    Member
    Posted 2 years ago #

    I'm not understanding exactly what I'm supposed to add, or exactly where to, to make the problem stop.

    I'm having the same difficulty but I do not understand your answer.

    I love the plugin, but it's a pain to re-upload that image every time I need to edit a post.

  4. pszeinert
    Member
    Posted 2 years ago #

    I thought I figured this out a number of times, but I finally got to an answer with a dead simple method.

    Go to line 33 and add:
    $attachID=get_post_meta($post->ID,'_pin_image',true);

    Then go to line 55 (it was line 54 before we added that last line) and replace the entire line with:
    <input type="hidden" name="pin_image" id="pin_image" value="'.$attachID.'" />

    If you want to make it really easy, replace the entire public function for pinterest_html() with the following line of code; REPEAT - if you did the steps above, you do not need to do this.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Basically what we have done is pre-populate the hidden input value with the already saved image ID value. If it does not exist, it outputs nothing and therefore saves nothing if you don't add something. If you click remove a picture you have already save, it will still remove it.

    To optimize this code, it would be better to not save a value unless there is a change. My fix always saves a new value, even if it is the same as before. Small price to pay (a few milliseconds?), nevertheless good code is good code.

  5. pszeinert
    Member
    Posted 2 years ago #

    It seems like a lot of work to go through to paste code, but I guess I understand.

    That said, here is the code that was removed from above:

    http://pastebin.com/eFvjGW3R

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic