{"id":33832,"date":"2019-03-01T11:14:54","date_gmt":"2019-03-01T11:14:54","guid":{"rendered":"http:\/\/getshortcodes.com\/?post_type=docs&#038;p=33832"},"modified":"2020-06-11T22:33:41","modified_gmt":"2020-06-11T22:33:41","slug":"what-shortcodes-are-and-how-they-work","status":"publish","type":"docs","link":"https:\/\/getshortcodes.com\/docs\/what-shortcodes-are-and-how-they-work\/","title":{"rendered":"What shortcodes are and how they work"},"content":{"rendered":"<p class=\"h2\">Table of contents<\/p>\n\n<ol><li><a href=\"#intro\">Intro<\/a><\/li><li><a href=\"#simple-shortcodes\">Simple shortcodes<\/a><\/li><li><a href=\"#shortcodes-with-content\">Shortcodes with content&nbsp;<\/a><\/li><li><a href=\"#nested-shortcodes\">Nested shortcodes<\/a><\/li><\/ol><\/li><\/ol>\n\n\n<h2 class=\"wp-block-heading\" id=\"intro\">Intro<\/h2>\n\n\n\n<p>Shortcode is a specific WordPress code allowing you to create various elements on the site easily. With the help of shortcodes, you can publish videos, photo galleries, forms, etc. on the site using only one line of code. Shortcodes are written in square brackets.<\/p>\n\n\n\n<p>Shortcodes can be used in WordPress editor, in text widgets, in theme files, and other places.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"simple-shortcodes\">Simple shortcodes<\/h2>\n\n\n\n<p>This is how simple shortcode looks like:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[shortcode]<\/pre>\n\n\n\n<p>Shortcodes may have settings, for example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[gallery_shortcode ids=\"1, 2, 3\"]<br><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"shortcodes-with-content\">Shortcodes with content&nbsp;<\/h2>\n\n\n\n<p>Shortcode may have closing tag, with the help of which shortcode may contain some text. For example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[button] Click me [\/button]\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"nested-shortcodes\">Nested shortcodes<\/h2>\n\n\n\n<p>A shortcode may contain other shortcodes. However, identical shortcodes cannot be nested into each other. Example of nested shortcodes:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[box] Hello, [username] [\/box]\n<\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>WordPress provides a set of standard shortcodes:\u00a0<em>audio<\/em>,\u00a0<em>caption<\/em>,\u00a0<em>embed<\/em>,\u00a0<em>gallery<\/em>,\u00a0<em>video<\/em>, and\u00a0<em>playlist<\/em>. Learn more about shortcodes from\u00a0<a href=\"https:\/\/codex.wordpress.org\/Shortcode\">WordPress\u00a0codex<\/a>.<\/p>\n\n\n\n<p>Shortcodes Ultimate adds 50 new shortcodes which you can use.<\/p>\n\n\n\n<p>Note: shortcodes specified in this article are only examples and will not work on your site.<\/p>\n","protected":false},"featured_media":0,"template":"","docs_category":[20],"class_list":["post-33832","docs","type-docs","status-publish","hentry","docs_category-getting-started"],"_links":{"self":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/docs\/33832","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/types\/docs"}],"wp:attachment":[{"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/media?parent=33832"}],"wp:term":[{"taxonomy":"docs_category","embeddable":true,"href":"https:\/\/getshortcodes.com\/api\/wp\/v2\/docs_category?post=33832"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}