All Courses > Up and Running > Chapters > Understanding and Creating Shortcodes

Understanding and Creating Shortcodes

Key Takeaways:

Shortcodes are a simple way to add custom functionality—with dynamic user input— to post contents.
Shortcodes can accept user-defined attributes, which work as function arguments that alter the shortcodes' output.
Shortcodes are turned into HTML by shortcode handler functions. All shortcode handler functions must return a string, which WordPress will print to the page at the location where the user called the shortcode.

WordPress shortcodes are a simple way to add styling or other customizations inside the content of a Post, Page, or custom post type. They can make adding standard layout code to a post much easier.

The Shortcode User Interface
This section covers how shortcodes appear to WordPress site users.

The Simplest Possible Shortcode
Shortcodes have a very simple anatomy:
<--Environment: This is a WordPress post's content-->

[simple_shortcode]

If ...