As seen in the previous chapters, shortcodes are special blocks of text that can be easily added in any post or page to be replaced by content when they are found in pages visited by users. This recipe uses the add_shortcode function to declare a new shortcode that gets replaced with a review submission form.
The form itself is created using standard HTML and displays a number of text fields. It also uses a bit of PHP code to dynamically build the list of ratings and book types defined in the system. The form also includes a PHP call to the wp_nonce_field function, which was previously seen when creating plugin configuration panels, to add hidden fields that will be used as a security measure in the associated data processing function. Finally, the code checks to see whether the user visiting the page is logged in to the website and displays a short message instead of the submission form when the check is negative.
When submitted, the form action will send visitor content to the page where the book review form is displayed. This new content will be intercepted and processed in the code that will be added in the next recipe.