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.

How to add a form via a custom php wordpress hook?

  1. Hi, I love that the forms can be added within the post itself.

    BUT I want to add the form in a different location that the post itself. I have a custom type of 'job' and for every single 'job' post I want to add the form 'apply for this job' so that it shows up below every single job post.

    I'm using Thesis as my developer theme and this custom code for a wordpress hook to add the form:

    function add_applyforthejob() {
    global $thesis_design;
    if (is_single() && get_post_type() == 'job') {
    ?>
    [gravityform id="2" name="Apply for the job"]
    <?php
    }
    }
    add_action('thesis_hook_after_content', 'add_applyforthejob');

    WHAT IS THE CORRECT PHP CALL / CODE TO ADD A GF FORM?

    You can see what I'm trying to do here: http://clientsof.cathiegraphy.com/HuntersRecruitment/job/german-speaking-vat-account-manager/

    Thanks
    Cathie

    Posted 12 years ago on Friday March 16, 2012 | Permalink
  2. Can anyone help me with this?

    Posted 12 years ago on Monday March 19, 2012 | Permalink
  3. There are instructions on how to display a form using a PHP function call in the Documentation area of the support site here:

    http://www.gravityhelp.com/documentation/page/Embedding_A_Form

    To display a form using PHP you use a function call. When displaying a form via PHP you also need to use the enqueue function to make sure that the necessary scripts and styles for that form get enqueued as the form function itself does not enqueue the scripts and styles as it can be placed anywhere and WordPress only allows functions to enqueue from certain points in the WordPress page execution lifecycle.

    That is explained in the documentation above along with additional documentation for the gravity_form_enqueue_scripts function call. If Thesis custom hooks are executed at a point where things can be enqueued, then you should be able to pair both functions in one location when using the Thesis hook.

    You'll have to discuss proper implementation using the Thesis hook with the Thesis support team. But the function calls in the documentation above is what you will use to display the form.

    Posted 12 years ago on Monday March 19, 2012 | Permalink

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