• Kenny

    (@thesiscustoms)


    I figured I would share this:
    The end goal: Add an “Edit” button/link at the bottom of each post that would redirect to the Gravity Forms update post page.

    This is a sample URL to the form:
    yourdomain.com/edit-post-test/

    Here is a sample URL that passes post_id:
    yourdomain.com/edit-post-test/?gform_post_id=1

    What I did after creating the form:
    1. Using Thesis Skin Editor I Added a “Hook Name” to the Post Box on the “Single” template (for single post display). The hook name I used was “gravity_edit”.
    2. From WP dashboard I went to Appearance>Editor and added the code below into the functions.php file.

    function gravity_edit() { ?>
    <a href="http://yourdomain.com/edit-post-test/?gform_post_id=<?php echo get_the_ID( $post_id, 'custom_field_name', true ); ?>">Edit</a>
    	<?php
    }
    add_action('thesis_hook_post_box_gravity_edit_bottom', 'gravity_edit');

    That was it! Now when I view a post, I see “Edit” and once I click it I see that post and can edit it with Gravity Forms. Yeah!

    Their is more I would like to do… like add permission to the form page… etc. but that’s all basic stuff we all know already.

    Sources:
    http://www.endocreative.com/5-tips-tricks-gravity-forms/
    http://diythemes.com/thesis/rtfm/add-custom-php-functions/
    https://codex.wordpress.org/Function_Reference/get_post_meta

    https://wordpress.org/plugins/gravity-forms-update-post/

  • The topic ‘Passing Post_ID using Thesis 2 – May help others’ is closed to new replies.