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.

Inserting wordpress post or PHP into HTML form field

  1. Hi I'd like to know whether it's possible to insert wordpress content like a specific post for example inside the HTML content form field.

    I have a form

    Which has in one of it's steps a selection top choose a vehicle type. I'd like to then allow the vehicle type post from my Vehicle Groups Category to show conditionally. Right now I've inserted it with plain HTML, but each time I update the content I'd need to edit it again in the Form HTML

    Please let me know if this is possible by inserting a WordPress query or shortcode or something into the form HTML field.


    Posted 9 years ago on Thursday December 15, 2011 | Permalink
  2. I think you can use the gform_pre_render hook which will run before the form is displayed. The function you hook to can perform your query to pull your HTML content in, then populate that HTML field in your form. Seems like it should work.

    It would not be done in the form builder but in a bit of code added to your theme's functions.php.

    Posted 9 years ago on Thursday December 15, 2011 | Permalink
  3. Ok thanks for the tip, though I have no idea where to even start using that hook. I'm more of a front end person. If there's any snippets anywhere I can adapt or learn from I would appreciate anyone sharing that thanks.

    otherwise if anyone can create something at a fee I might consider paying if it's not too much

    Posted 9 years ago on Monday December 19, 2011 | Permalink
  4. I don't believe it's been done before. I can see the need for it though. I have used posts in the past for content like this, and then just included that content in various places. Hide it from your search results and in the navigation, etc.

    The best place to start is with the documentation page for the hook:

    And also follow the tag in this forum:

    And you will find many example of using it.

    If you'd like to hire someone, you can find someone here:

    Or post a job of your own here:

    Posted 9 years ago on Tuesday December 20, 2011 | Permalink
  5. sascha

    That's sounds like an interesting idea. Keep me posted.

    Posted 9 years ago on Saturday January 14, 2012 | Permalink