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?
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.
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.