The Cheap & Lazy Way to Display Form Entries on the Front End of a WordPress Site
I decided I wanted a Guestbook on this little ol’ site of mine after seeing a bunch of folks sharing Manu’s excellent example. I wanna be like the cool kids, too! I’d probably follow them jumping off a virtual bridge, too.
But really, I love the undercurrent of life going back into personal blogging these recent days.
I’m still a WordPress guy after all these years and no plans to change. Maybe I wouldn’t follow the cool kids off a bridge, after all. Anyways, I wound up with a Guestbook I’m rather fond of and thought I’d share my approach. WordPress has no shortage of functions, hooks, actions, and workarounds that would allow a visitor to “sign” a page on my site, some more challenging and impressive than others.
I ain’t go no time for all that. I need something quick and easy dangnabit. I got mouths to feed and Spring training baseball is back.
I Could Allow Comments on a Page
Boom, done. It’s Friday afternoon. Ship it. ????
But Here’s How I Did It
I already use Gravity Forms for form submissions and I like the idea of capturing guestbook signatures with my contact form submissions. And if I can turn a Gravity Forms submission into a guestbook signature, then that sounds like a plan that works for me.
There are excellent paid premium plugins that do this very thing, GravityKit and Gravity Wiz being two well-known offerings. You may have gathered from the title of this post that I’m cheap and want a solution as cheap as me.
First, I found Tablesome. It’s a free plugin for creating fancy-ass tables that support filtering, re-ordering, and all that. The plugin can things like listen for new posts to publish and automatically display it as a new table row. Better than that, Tablesome can listen for new Gravity Form submissions and turns them into an archive of standard WordPress posts, as well as custom post types. This is exactly what I would otherwise have to spend money on in the form of a paid plugin or do the difficult work of engineering a solution.
Next, I set up a new form. Nothing fancy, but I did turn off most of Gravity Forms’ included styles because they were dinging my core web vitals. It’s a great plugin — one of the best, I’d say! — but styling is one of those things I’m more opinionated about.
Then I created a new page and you’ll never guess what I called it… Guestbook. That’s where I embedded the form.
Next, I set up a new custom post type for Guests.
Registering a new custom post type is one of those things you sorta develop muscle memory for with years of working in functions.php
. I’ve had custom post types on this site before but nuked them for various reasons. I’d normally register them in a new custom plugin for maintainability, so I decided to reach for the Custom Post Type UI plugin. If I’m going to need a plugin anyway, may as well get an interface for managing those post types. Why this isn’t baked into WordPress Core is beyond me. (How neat would it be to fire up a new post type simply by adding a new post type template via the Site Editor?!)
This is where Tablesome comes into the picture. I don’t need it for tables, but for its form-to-post conversion magic. Using a table-making plugin for non-table-making purposes feels weird. No shade, naming is hard.
Tablesome’s process for connecting a form submission to a post type is fairly trivial. You set a trigger that the plugin listens for (like a form submission) and connect it to an action (like publishing a new post). From there, you’re able to map form fields to post fields so Tablesome knows where to slot the content sent in from the form.
It’s not totally unlike configuring triggers and actions in Zapier. Same thing, different product with a different focus.
Now, when someone (maybe you?) “signs” the guestbook, a new Guest post draft is generated.
That lets me moderate any incoming guest signatures. And when I flip the switch to Published, the post is fed to a Query Loop block on the page that is configured to display the content.
And the result winds up on the front end, displayed below the guestbook form.
That’s just a test submission, so I really have no signatures at the moment. Maybe you’ll help me break in this new guestbook and consider signing it? ????
4 Comments
Wow, amazing post, I just want to go to my website and implement exactly that and create my own guestbook.
Nice tips on gravity forms and tablesome
, could come handy also in my workplace (which uses woocommerce and is heavy on forms, hand coded at the moment)
p.s
I didn’t even read this blog post when I saw the empty guestbook. Got lucky to sign in first :)
Mentions
Likes