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.

Selecting a specific post template

  1. RichardBest
    Member

    Hi there

    As always, thanks for the fantastic plugin. Really is superb.

    My latest question is whether it'd be possible to add a feature by which one could, when adding a post through a GF form, select a specific post template. What I have in mind here is GF hooking up with Nathan Rice's Single Post Template plugin. When setting up the form, one could select in the post (title or body fields) whether posts going through that particular form should be assigned to/use a different/specific post template.

    This would be an awesome addition to the plugin...

    If it's not on the horizon, perhaps we could have an email chat about whether you'd be interested in developing it for me please.

    Many thanks
    Richard

    Posted 15 years ago on Saturday November 14, 2009 | Permalink
  2. Richard,
    You accomplish this functionality by using a hook. It will require a few lines of PHP code, but I will be happy to send you a code snippet. I will post it here when I get it done.

    Posted 15 years ago on Saturday November 14, 2009 | Permalink
  3. RichardBest
    Member

    Thanks Alex. That's superb. When looking over my post above, it occurred to me that I could have been clearer.

    The key thing I'm after please is the ability for the admin to select a given post template for a given form, when the admin creates the form. There's no need for the form user to be able to select the post template and indeed I'd not want them to be able to do so (as it would be confusing).

    Apologies if my post above was not so clear.

    Thanks again
    Richard

    Posted 15 years ago on Saturday November 14, 2009 | Permalink
  4. Richard,
    I understand what you are trying to do. Using the hooks will allow you (administrator) to assign the post to whatever template you want. The only limitation is that you won't be able to change the template via the UI, since it will be "hardcoded" in the PHP code. This solution will probably work if you won't need to change the template very often. If you think this could work for you, let me know and I will come up with the code for you.

    Posted 15 years ago on Sunday November 15, 2009 | Permalink
  5. RichardBest
    Member

    Thanks Alex. What I'm hoping to be able to achieve is a situation where I can choose different post templates for different GF forms. It wouldn't matter if I had to hard code that for the different forms, but I do need the ability to use different post templates for the different forms. Would that be possible do you think?

    Many thanks for your help with this. I really appreciate it.

    Richard

    Posted 15 years ago on Sunday November 15, 2009 | Permalink
  6. Richard,
    I just realized that you will be able to do this without having to write any code in 1.3, which we will release tomorrow (Monday). After upgrading to 1.3, you will need to do the following.
    1- Add a "Post Custom Field" field to the form.
    2- Set the Field Type to "Hidden"
    3- Choose "New" for "Custom Field Name" and type "_wp_post_template"
    4- In the Advanced Tab, type the file name for the template you would like to use. (i.e. template1.php)

    Posted 15 years ago on Sunday November 15, 2009 | Permalink
  7. RichardBest
    Member

    Holy crap. Thanks Alex. Will try that out tonight. How is it, incidentally, that utilising a post custom field can result in using a custom post template?? Didn't know that was possible. In any event, I look forward to testing this tonight.

    Cheers
    Richard

    Posted 15 years ago on Monday November 16, 2009 | Permalink
  8. RichardBest
    Member

    Hi Alex

    I tried this with the beta version of 1.3 but couldn't get it to work. At step 4, into which field in the Advanced Tab do you type the name of the post template you wish to use?

    Many thanks
    Richard

    Posted 15 years ago on Monday November 16, 2009 | Permalink
  9. Sorry Richard. You type the template file name in the "Default Value" field.
    The reason this works is because the Post Template plugin by Nathan Rice associates a post with a template via a custom field.

    Posted 15 years ago on Monday November 16, 2009 | Permalink
  10. RichardBest
    Member

    Brilliant. Thanks Alex. I've now got this working. It, together with the custom fields functionality in v 1.3, brings super power to Gravity Forms!

    Posted 15 years ago on Monday November 16, 2009 | Permalink
  11. Nice! I am glad to hear it worked for you.

    Posted 15 years ago on Monday November 16, 2009 | Permalink