A shortcode is a WordPress-specific code that lets you do nifty things with very little effort. Shortcode can display a list of posts, embed videos or create objects that would normally require lots of complicated code in just one line.
They are written by providing a handler function. Shortcode handlers are broadly similar to WordPress filters: they accept parameters (attributes) and return a result (the shortcode output).
In the previous example, the shortcode is called “resources_menu”. Its event (green box) is connected to the return component. The return value is connected to the generated content of the “resources_templates” box.
In this example, “resources_template” is a dynamic template that receives a list of pages from the “get_pages” component and render a hierarchical menu. See how templates work ?