Creating a client-side content submission form
The first step toward giving visitors the ability to contribute to a website is to present a form that they can use to submit new content. This recipe shows how to create a shortcode that can easily be inserted on any WordPress page to render a simple form.
Getting ready
You should be running the final version of the Chapter 4 - Book Reviews plugin created in Chapter 4, The Power of Custom Post Types. Alternatively, you can download the final resulting code (ch4/ch4-book-reviews/ch4-book-reviews-v12.php
) from the book's GitHub page.
How to do it...
Follow these steps to create a new shortcode that displays a simple form:
- Navigate to the WordPress
plugins
directory of your development installation. - Create a new directory called
ch7-book-review-user-submission
and open it. - Create a text file called
ch7-book-review-user-submission.php
. - Open the new file in a code editor and add an appropriate header at...