Why create WordPress pages automatically?
There are a ton of reasons you might want to let users create their own WordPress posts or pages without giving them access to the admin side of WordPress. Here are three quick examples:
- You’re a service provider who wants people to leave testimonials
- You’re creating a product that let’s real estate agents quickly create property micro-sites
- You want a directory of vendors, authors, partners, etc – each with their own page
Whatever the reason, the truth is that it’s not that hard. Especially if you’re using FormidablePro.
Let’s get started.
1. Pick up a copy of FormidablePro
I know, it’s a bit silly, but this tutorial requires it. Why not GravityForms (which I also really love)? Because FormidablePro creates pages, posts and custom post types automatically. No code. No additional plugins. No work-arounds. All automatic.
2. Create a new form
Just click on the buttons on the right and you’ll see the fields appear on the left. It’s incredibly easy. Make sure you create at least one ‘single line’ field, so that can be used for your post title. In my case, I’m imagining creating a simple micro property page, so I’m going to collect a street address.
Also notice you can put image url fields, and even image uploads (perfect for situations where you want a good image on the new page). But I decided not to fill up my test area with a bunch of uploaded images, so it’s image urls for now.
3. Configure the settings to create the page
Notice in settings that I don’t start with “General.” I’ll come back to that last. First, for me, is the “Create Posts” option. This let’s me create a page automatically, using the form content. You’ll notice I use the single line entry for my post title. I also let the slug be created automatically from it as well. I also mark the post status to be automatic (I don’t want a bunch of drafts for this demo, but you may for what you’re doing).
Lastly, is the content of the new page. I can type anything I want, including the use of all the fields I just collected. Notice the drop down above the space for the customized content. It has all my fields ready (so I don’t have to go looking up field IDs). I can also put the uploaded or url image references inside normal tags (like the image tag) to display the content.
4. Configure Email
I then jump over to the email settings and instead of just getting an email to me ([admin email]), I also put the submitter’s email (given to me on the form). I configure the body of the email and hit save.
This means a page will be created and then an email will be sent out announcing it.
5. Configure the General Settings
Now we get to the general settings. You may have noticed that I sent the url of the new page to the user in the last screen. Well here you can see it more clearly. When the page is submitted, notice I am redirecting them to a new url that has my site_url and then field 121 (the single line). But I also add a ‘sanitize_url=1’ to that permalink. This enables me to ensure that I’ll go to the newly created page right as I click on ‘submit.’
Since I asked the form to auto-create the page based on that field, I should be able to route to it, as long as I sanitize the url.
Here is the form (placed by dropping the short code on the WordPress page).
And here is the automatically-created WordPress page.