The first step toward giving visitors the ability to contribute to a website is to present a form that they will be able to 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.
You should be running the final version of the Book Reviews plugin created in Chapter 4, The Power of Custom Post Types, or using the final resulting code (Chapter 4/ch4-book-reviews/ch4-book-reviews-v11.php
) from the downloaded code bundle.
- Navigate to the WordPress plugin directory of your development installation.
- Create a new directory called
ch6-book-review-user-submission
and open it. - Create a text file called
ch6-book-review-user-submission.php
. - Open the new file in a code editor and add an appropriate header at the top of the plugin file, naming the plugin
Chapter 6 - Book Review User Submission
. - Add the following line of code to declare a new shortcode...