Skip Navigation

[Resolved] Best way to do custom forms with PHP processing

This support ticket is created 8 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 2.48 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by scottL-3 8 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#423530

I am trying to: build and process a form within a page w/o a plugin

Before switching to Toolset, I used page templates to be able to add a form to a page with the form processing PHP code built-in. For simple contact forms I prefer not to add a form plugin.

With Layouts / the Toolset Starter Theme, there are no page templates anymore. There are custom post type templates but I don't need a custom post type, just to show the form after the page's content and route the form by email based on data entered.

I assume I could make this work by moving all my form code into functions.php and turning it into a plugin but that is pretty messy for a variety of reasons. I also assume I could use CRED and its notifications but I really don't want to store the form data in the WordPress database, I just want to email it. I could also cram my form code into the single.php and somehow make it conditional but that adds overhead to every page.

Is there a way to add a custom page template to a Layouts based site or to the Toolset Starter Theme?

#423622

Dear scott,

For the question:
Is there a way to add a custom page template to a Layouts based site or to the Toolset Starter Theme?
I suggest you create a custom shortcode for the your custom form code, then put the shortcode into layout content, see wordpress document:
https://codex.wordpress.org/Function_Reference/add_shortcode
Adds a hook for a shortcode tag.

#428165

The workaround works but doing form processing in a shortcode / plugin is a lot harder than in a page template. It would be good to find a way to make page templates and Toolset's tools work together in the future.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.