上QQ阅读APP看书,第一时间看更新
Shortcode implementation
Shortcodes are the quickest way to add dynamic content to your pages. In this situation, we need to create a page for registration. Therefore, we need to create a shortcode that generates the registration form.
We can add shortcodes to our application by including them inside functions.php file of the theme or within any custom plugin. I recommend adding these shortcodes in a custom plugin since you will loos the additional code in functions.php file on theme updates.
Let’s take a look at the shortcode that displays our registration form, as shown in the following code:
add_shortcode( "register_form", "display_register_form" );
functiondisplay_register_form(){
$html = "HTML for registration form";
return $html;
}
Then, you can add the shortcode inside the created page using the following code snippet to display the registration form:
[register_form]