{"id":88823,"date":"2012-11-20T12:55:09","date_gmt":"2012-11-20T11:55:09","guid":{"rendered":"http:\/\/designmodo.com\/?p=88823"},"modified":"2024-06-05T11:20:44","modified_gmt":"2024-06-05T11:20:44","slug":"wordpress-shortcodes","status":"publish","type":"post","link":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/","title":{"rendered":"Understanding and using WordPress Shortcodes"},"content":{"rendered":"<p>WordPress as a platform provides really good support for plugin developers to create functionality on top of WordPress. WordPress lets the plugin developer create functionality which the post creator can use as a macro in the post or the page he publishes. These <span style=\"text-decoration: underline;\">macros are called as Shortcode<\/span>.<\/p>\n<p>The WordPress platform provides a very good API support for creating shortcodes. <strong>WordPress shortcode api\u2019s<\/strong> provide good support for creating shortcodes, removing shortcodes , parsing the arguments of shortcode etc . This makes the plugin developer just concentrate on the functionality he wants to provide via his shortcode and not worry about the other infrastructure things required for the shortcode.<\/p>\n<p>In this article we are going to see what all support does WordPress provide to create a shortcode and how to use WordPress shortcode api\u2019s and create your own shortcodes.<\/p>\n<h2>Creating a simple Shortcode<\/h2>\n<p>Let\u2019s start by creating a simple shortcode which displays the latest five posts with their titles and links to them. The code to create the shortcode is as follows:<\/p>\n<p>[php]<br \/>\nfunction display_latest_post()<br \/>\n{<\/p>\n<p>    $result = &#8221;;<br \/>\n    $query = new WP_Query( &#8216;posts_per_page=3&#8217; );<br \/>\n    \/\/ The Loop<br \/>\n    while ( $query-&amp;amp;gt;have_posts() ) : $query-&amp;amp;gt;the_post();<br \/>\n        $result.= &#8216;&amp;amp;lt;li&amp;amp;gt;&#8217;;<br \/>\n        $result.= &#8216;&amp;amp;lt;a href=&amp;amp;quot;&#8217;.get_permalink().&#8217;&amp;amp;quot;&amp;amp;gt;&#8217;.get_the_title().&#8217;&amp;amp;lt;\/a&amp;amp;gt;&#8217;;<br \/>\n        $result.= &#8216;&amp;amp;lt;\/li&amp;amp;gt;&#8217;;<br \/>\n    endwhile;<\/p>\n<p>    \/\/ Reset Post Data<br \/>\n    wp_reset_postdata();<\/p>\n<p>    \/\/return the result<br \/>\n    return $result;<br \/>\n}<\/p>\n<p>function register_shortcodes(){<br \/>\n  add_shortcode( &#8216;DISPLAY_LATEST_POSTS&#8217;, &#8216;display_latest_post&#8217; );<br \/>\n}<\/p>\n<p>add_action( &#8216;init&#8217;, &#8216;register_shortcodes&#8217;);<\/p>\n<p>[\/php]<\/p>\n<p>In the above code we first create a function <em>display_latest_post<\/em>. This function uses WP_Query to query the WordPress post to get the latest three posts from the database. Then we loop on the query to get the post title and the permalink of the post. Then we return the result from the function.<\/p>\n<p>Once we have written the function for getting the latest post to create a shortcode to display the latest post we will have to use the <em>add_shortcode<\/em> function provided by WordPress. The <em>add_shortcode<\/em> function takes two arguments, first the tag which will be used in the post content and second is the name of the function. Hence we use the <em>add_shortcode<\/em> function as<\/p>\n<p>[php]<br \/>\nadd_shortcode( &#8216;DISPLAY_LATEST_POSTS&#8217;, &#8216;display_latest_post&#8217; );<br \/>\n[\/php]<\/p>\n<p>For more details on add_shortcode you can visit the following <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/add_shortcode\/\">link<\/a>.<\/p>\n<p>Once we have added the above code our shortcode is ready for use.To use our shortcode we create a new post and add the shortcode tag in square brackets as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88824\" title=\"WordPress Shortcodes Image 1\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/image001.png\" alt=\"WordPress Shortcodes Image 1\" width=\"600\" height=\"297\" \/><\/p>\n<p>Once we create the post and go to the post page we will see the latest three posts on it with its permalink as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88825\" title=\"WordPress Shortcodes Image 2\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/image002.png\" alt=\"WordPress Shortcodes Image 2\" width=\"600\" height=\"201\" \/><\/p>\n<h3>Passing arguments to shortcode<\/h3>\n<p>The above shortcode is a basic shortcode and does not take any arguments and cannot be customized when adding in the post content. WordPress also provides a way to <strong>add arguments to the shortcode<\/strong> which can be used to customize the output of the shortcode. This really can enhance the value of a particular shortcode.<\/p>\n<p>Now let\u2019s modify the above Shortcode to take arguments like number of post to display and to display post from some specific category.<\/p>\n<p>The code will be as follows:<\/p>\n<p>[php]<br \/>\nfunction display_latest_post($atts)<br \/>\n{<br \/>\n    extract( shortcode_atts( array(<br \/>\n\t\t&#8216;numberofpost&#8217; =&amp;amp;gt; &#8216;3&#8217;,<br \/>\n\t\t&#8216;categoryid&#8217; =&amp;amp;gt; &#8221;,<br \/>\n\t), $atts ) );<\/p>\n<p>    $result = &#8221;;<br \/>\n    $querystring = &#8216;posts_per_page=&#8217;.$numberofpost;<br \/>\n    if(strlen($categoryid) &amp;amp;gt; 0)<br \/>\n        $querystring .= &#8216;&amp;amp;amp;cat=&#8217;.$categoryid;<br \/>\n    $query = new WP_Query( $querystring );<br \/>\n    \/\/ The Loop<br \/>\n    while ( $query-&amp;amp;gt;have_posts() ) : $query-&amp;amp;gt;the_post();<br \/>\n        $result.= &#8216;&amp;amp;lt;li&amp;amp;gt;&#8217;;<br \/>\n        $result.= &#8216;&amp;amp;lt;a href=&amp;amp;quot;&#8217;.get_permalink().&#8217;&amp;amp;quot;&amp;amp;gt;&#8217;.get_the_title().&#8217;&amp;amp;lt;\/a&amp;amp;gt;&#8217;;<br \/>\n        $result.= &#8216;&amp;amp;lt;\/li&amp;amp;gt;&#8217;;<br \/>\n    endwhile;<\/p>\n<p>    \/\/ Reset Post Data<br \/>\n    wp_reset_postdata();<\/p>\n<p>    \/\/return the result<br \/>\n    return $result;<br \/>\n}<\/p>\n<p>[\/php]<\/p>\n<p>Here now in function <em>display_latest_post<\/em> we take the arguments which can be passed from the shortcode. Then we pass the arguments which we get from the shortcode and a array of default values to the WordPress function <em>shortcode_atts<\/em>. The function <em>shortcode_atts<\/em> merges the two values from the default array and from the array which is passed as argument. This becomes useful as in some cases the person using the shortcode might not want to specify all the arguments and might just want to pass some arguments.<\/p>\n<p>You can get more details about <em>shortcode_atts<\/em> at the following <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/shortcode_atts\/\">link<\/a>.<\/p>\n<p>Then in case the arguments are passed to our shortcode function we will use those values and create the query for WP_Query appropriately.<\/p>\n<p>So in case if I want to show only one post in category 10, I will use the shortcode as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88826\" title=\"WordPress Shortcodes Image 3\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/image003.png\" alt=\"WordPress Shortcodes Image 3\" width=\"600\" height=\"235\" \/><\/p>\n<p>The output on the post will be as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88827\" title=\"WordPress Shortcodes Image 4\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/image004.png\" alt=\"WordPress Shortcodes Image 4\" width=\"600\" height=\"126\" \/><\/p>\n<h3>Using enclosing Shortcodes<\/h3>\n<p>WordPress allows to even us enclose only some part of the content of the post between the shortcode. Then that content is passed to your shortcode handler and then based on the content or some other logic the shortcode handler can return the appropriate content back.<\/p>\n<p>Now let\u2019s create a small enclosing shortcode which will show the content itself if the user is logged in and will hide the content and show the login link in case the user viewing the post is not logged in.<\/p>\n<p>The code for our shortcode is as follows:<\/p>\n<p>[php]<br \/>\nfunction check_logged_in( $atts, $content = null )<br \/>\n{<br \/>\n    if ( is_user_logged_in() )<br \/>\n      return  $content;<br \/>\n    else<br \/>\n     return &#8216;&amp;amp;lt;a href=&amp;amp;quot;&#8217;.wp_login_url().&#8217;&amp;amp;quot; title=&amp;amp;quot;Login&amp;amp;quot;&amp;amp;gt;Please login to see the content&amp;amp;lt;\/a&amp;amp;gt;&#8217;;<br \/>\n}<\/p>\n<p>function register_shortcodes(){<br \/>\n  add_shortcode( &#8216;DISPLAY_LATEST_POSTS&#8217;, &#8216;display_latest_post&#8217; );<br \/>\n  add_shortcode( &#8216;CHECK_LOGGED_IN&#8217;, &#8216;check_logged_in&#8217; );<br \/>\n}<\/p>\n<p>[\/php]<\/p>\n<p>In our shortcode handler the second argument passed is the content which will be enclosed by our shortcode. In our handler we first check if the user has logged in using the WordPress function <em>is_user_logged_in()<\/em>. In case he has not then we get the login url from the WordPress function <em>wp_login_url<\/em> and then return a link to the login page.<\/p>\n<p>The &#8216;CHECK_LOGGED_IN\u2019 shortcode can be used on partial content of a post as shown below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88828\" title=\"WordPress Shortcodes Image 5\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/image005.png\" alt=\"WordPress Shortcodes Image 5\" width=\"600\" height=\"294\" \/><\/p>\n<p>In case the user is logged in the output will be as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88829\" title=\"WordPress Shortcodes Image 6\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/image006.png\" alt=\"WordPress Shortcodes Image 6\" width=\"600\" height=\"166\" \/><\/p>\n<p>In case the user is not logged in the content of the post will be as follows:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-88830\" title=\"WordPress Shortcodes Image 7\" src=\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2024\/06\/image007.png\" alt=\"WordPress Shortcodes Image 7\" width=\"600\" height=\"195\" \/><\/p>\n<h3>Apply Shortcodes Programmatically<\/h3>\n<p>Till now we saw how to create shortcodes using the WordPress shortcode API. We also saw how we can use the shortcodes in our post or pages content.<\/p>\n<p>We can even use the shortcode in our templates or as part of some other function in our theme or plugin. This can be done with the help of the WordPress function do_shortcode.<\/p>\n<p>The WordPress function do_shortcode takes in the content and in case there are any shortcodes inside that content those will be evaluated and returned as the output of the function.<\/p>\n<p>So in case we want to display the latest post in our theme we can do it using our shortcode as follows:<\/p>\n<p>[php]<br \/>\necho do_shortcode(&#8216;[DISPLAY_LATEST_POSTS]&#8217;);<br \/>\n[\/php]<\/p>\n<h3>Some other useful WordPress Shortcode functions<\/h3>\n<p>Once we are comfortable with creating and using WordPress shortcodes now let\u2019s take a look at some other helpful functions which WordPress provides related to shortcodes.<\/p>\n<ul>\n<li>remove_shortcode \u2013<\/li>\n<\/ul>\n<p>This function takes in the tag used to add the shortcode. This function removes a shortcode which was previously added with <em>add_shortcode<\/em>. This might be useful in case you have multiple plugins adding shortcodes and you don\u2019t want some of the shortcodes to be used on your site.<\/p>\n<ul>\n<li>remove_all_shortcodes \u2013<\/li>\n<\/ul>\n<p>This function removes all the added shortcode.<\/p>\n<ul>\n<li>strip_shortcodes \u2013<\/li>\n<\/ul>\n<p>This function takes in the content as a parameter and strips off all the shortcode tags in the content. This function might be useful in case you want to show the shortcodes only on some particular pages.<\/p>\n<h2>Conclusion<\/h2>\n<p>WordPress as a platform provides a great level of api support to create shortcodes. Shortcodes in WordPress are easy to create and are easy to use. Very useful functionality of various kinds can be provided using WordPress shortcode. So have fun while using shortcode in the next WordPress plugin you use.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress as a platform provides really good support for plugin developers to create functionality on top of WordPress. WordPress lets the plugin developer create functionality which the post creator can use as a macro in the post or the page he publishes. These macros are called as Shortcode. The WordPress platform provides a very good [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":88841,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-88823","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Understanding and using WordPress Shortcodes - WordPress Guides<\/title>\n<meta name=\"description\" content=\"In this article we are going to see what all support does WordPress provide to create a shortcode and how to use WordPress shortcode api\u2019s and create your own shortcodes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Understanding and using WordPress Shortcodes - WordPress Guides\" \/>\n<meta property=\"og:description\" content=\"In this article we are going to see what all support does WordPress provide to create a shortcode and how to use WordPress shortcode api\u2019s and create your own shortcodes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/\" \/>\n<meta property=\"og:site_name\" content=\"WordPress Guides\" \/>\n<meta property=\"article:published_time\" content=\"2012-11-20T11:55:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-06-05T11:20:44+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3\"},\"headline\":\"Understanding and using WordPress Shortcodes\",\"datePublished\":\"2012-11-20T11:55:09+00:00\",\"dateModified\":\"2024-06-05T11:20:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/\"},\"wordCount\":1468,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#organization\"},\"image\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#primaryimage\"},\"thumbnailUrl\":\"\",\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/\",\"url\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/\",\"name\":\"Understanding and using WordPress Shortcodes - WordPress Guides\",\"isPartOf\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2012-11-20T11:55:09+00:00\",\"dateModified\":\"2024-06-05T11:20:44+00:00\",\"description\":\"In this article we are going to see what all support does WordPress provide to create a shortcode and how to use WordPress shortcode api\u2019s and create your own shortcodes.\",\"breadcrumb\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/strictthemes.com\/articles\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Understanding and using WordPress Shortcodes\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#website\",\"url\":\"https:\/\/strictthemes.com\/articles\/\",\"name\":\"WordPress Guides\",\"description\":\"Create WordPress websites for begginers.\",\"publisher\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/strictthemes.com\/articles\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#organization\",\"name\":\"WordPress Guides\",\"url\":\"https:\/\/strictthemes.com\/articles\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png\",\"contentUrl\":\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png\",\"width\":500,\"height\":500,\"caption\":\"WordPress Guides\"},\"image\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/strictthemes.com\/articles\"],\"url\":\"https:\/\/strictthemes.com\/articles\/author\/andrian\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Understanding and using WordPress Shortcodes - WordPress Guides","description":"In this article we are going to see what all support does WordPress provide to create a shortcode and how to use WordPress shortcode api\u2019s and create your own shortcodes.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/","og_locale":"en_US","og_type":"article","og_title":"Understanding and using WordPress Shortcodes - WordPress Guides","og_description":"In this article we are going to see what all support does WordPress provide to create a shortcode and how to use WordPress shortcode api\u2019s and create your own shortcodes.","og_url":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/","og_site_name":"WordPress Guides","article_published_time":"2012-11-20T11:55:09+00:00","article_modified_time":"2024-06-05T11:20:44+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#article","isPartOf":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/"},"author":{"name":"admin","@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3"},"headline":"Understanding and using WordPress Shortcodes","datePublished":"2012-11-20T11:55:09+00:00","dateModified":"2024-06-05T11:20:44+00:00","mainEntityOfPage":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/"},"wordCount":1468,"commentCount":6,"publisher":{"@id":"https:\/\/strictthemes.com\/articles\/#organization"},"image":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#primaryimage"},"thumbnailUrl":"","articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/","url":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/","name":"Understanding and using WordPress Shortcodes - WordPress Guides","isPartOf":{"@id":"https:\/\/strictthemes.com\/articles\/#website"},"primaryImageOfPage":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#primaryimage"},"image":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#primaryimage"},"thumbnailUrl":"","datePublished":"2012-11-20T11:55:09+00:00","dateModified":"2024-06-05T11:20:44+00:00","description":"In this article we are going to see what all support does WordPress provide to create a shortcode and how to use WordPress shortcode api\u2019s and create your own shortcodes.","breadcrumb":{"@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/strictthemes.com\/articles\/wordpress-shortcodes\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/strictthemes.com\/articles\/"},{"@type":"ListItem","position":2,"name":"Understanding and using WordPress Shortcodes"}]},{"@type":"WebSite","@id":"https:\/\/strictthemes.com\/articles\/#website","url":"https:\/\/strictthemes.com\/articles\/","name":"WordPress Guides","description":"Create WordPress websites for begginers.","publisher":{"@id":"https:\/\/strictthemes.com\/articles\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/strictthemes.com\/articles\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/strictthemes.com\/articles\/#organization","name":"WordPress Guides","url":"https:\/\/strictthemes.com\/articles\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/","url":"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png","contentUrl":"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png","width":500,"height":500,"caption":"WordPress Guides"},"image":{"@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/strictthemes.com\/articles"],"url":"https:\/\/strictthemes.com\/articles\/author\/andrian\/"}]}},"_links":{"self":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts\/88823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/comments?post=88823"}],"version-history":[{"count":1,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts\/88823\/revisions"}],"predecessor-version":[{"id":689671,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts\/88823\/revisions\/689671"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/media?parent=88823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/categories?post=88823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/tags?post=88823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}