{"id":1954133,"date":"2022-09-12T11:12:02","date_gmt":"2022-09-12T15:12:02","guid":{"rendered":"https:\/\/theeventscalendar.com\/knowledgebase\/?post_type=post&#038;p=1954133"},"modified":"2025-10-28T18:27:19","modified_gmt":"2025-10-28T22:27:19","slug":"how-to-add-a-shortcode-in-wordpress","status":"publish","type":"post","link":"https:\/\/theeventscalendar.com\/knowledgebase\/how-to-add-a-shortcode-in-wordpress\/","title":{"rendered":"How to Add a Shortcode in WordPress"},"content":{"rendered":"\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/UPU46IOZic0?si=zBXzTyKTjsglYo1L\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n\n\n\n<p>With <a href=\"https:\/\/theeventscalendar.com\/products\/wordpress-events-calendar\/\" target=\"_blank\" rel=\"noreferrer noopener\">Events Calendar Pro<\/a>, you can <a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/k\/inserting-calendar-content-into-posts-or-pages\/\" target=\"_blank\" rel=\"noreferrer noopener\">add calendar content<\/a> to any WordPress page or post. There are a few different methods that you can use to add a shortcode to your WordPress site, and we&#8217;ll show you how to do it below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-add-a-shortcode-with-the-block-editor\">Add a shortcode with the Block Editor<\/h2>\n\n\n\n<p>To add a shortcode using the Block Editor, you&#8217;ll want to head over to any new page or post by selecting Pages (or Posts) &gt; Add New. <\/p>\n\n\n\n<p>From there, choose the + sign to add a block, then search for the &#8220;shortcode&#8221; block.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1908\" height=\"838\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.14.15-PM.png\" alt=\"add a shortcode with the block editor\" class=\"wp-image-1954134\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.14.15-PM.png 1908w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.14.15-PM-300x132.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.14.15-PM-1024x450.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.14.15-PM-768x337.png 768w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.14.15-PM-1536x675.png 1536w\" sizes=\"auto, (max-width: 1908px) 100vw, 1908px\" \/><\/figure>\n\n\n\n<p>Then, enter the shortcode you&#8217;d like to use in the field provided and click Publish.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1210\" height=\"212\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.15.45-PM.png\" alt=\"add a shortcode using the Block Editor\" class=\"wp-image-1954135\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.15.45-PM.png 1210w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.15.45-PM-300x53.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.15.45-PM-1024x179.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.15.45-PM-768x135.png 768w\" sizes=\"auto, (max-width: 1210px) 100vw, 1210px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-add-a-shortcode-with-the-classic-editor\">Add a shortcode with the Classic Editor<\/h2>\n\n\n\n<p>If you are using the Classic Editor, add the shortcode to the area of the post or page where you&#8217;d like to see it using the Text tab. Don&#8217;t forget to Publish or Update the post when you&#8217;re done!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1750\" height=\"894\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.21.54-PM.png\" alt=\"add a shortcode using the classic editor\" class=\"wp-image-1954136\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.21.54-PM.png 1750w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.21.54-PM-300x153.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.21.54-PM-1024x523.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.21.54-PM-768x392.png 768w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-12.21.54-PM-1536x785.png 1536w\" sizes=\"auto, (max-width: 1750px) 100vw, 1750px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-add-shortcode-to-wordpress-sidebar-widgets\">Add shortcode to WordPress sidebar widgets<\/h2>\n\n\n\n<p>To add a shortcode to a WordPress sidebar widget, head over to Appearance &gt; Widgets. Then, search for a shortcode widget block and add it to the sidebar with your desired shortcode.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"2192\" height=\"532\" src=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-1.28.20-PM.png\" alt=\"add a shortcode to widget area\" class=\"wp-image-1954137\" srcset=\"https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-1.28.20-PM.png 2192w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-1.28.20-PM-300x73.png 300w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-1.28.20-PM-1024x249.png 1024w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-1.28.20-PM-768x186.png 768w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-1.28.20-PM-1536x373.png 1536w, https:\/\/images.theeventscalendar.com\/kb\/uploads\/2022\/09\/Screen-Shot-2022-09-12-at-1.28.20-PM-2048x497.png 2048w\" sizes=\"auto, (max-width: 2192px) 100vw, 2192px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-add-shortcode-to-wordpress-theme-files\">Add shortcode to WordPress theme files<\/h2>\n\n\n\n<p>Lastly, you can add a shortcode right in your WordPress theme files. To do this, add the following shortcode to any WordPress template file.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php echo do_shortcode(&quot;&#x5B;your_shortcode]&quot;); ?&gt;\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-do-more-with-shortcodes\">Do more with shortcodes!<\/h2>\n\n\n\n<p>Now that you know how to add a shortcode to your site, check out our <a href=\"https:\/\/theeventscalendar.com\/knowledgebase\/category\/shortcodes\/\" target=\"_blank\" rel=\"noreferrer noopener\">Shortcode Resources<\/a> to use shortcodes with The Events Calendar plugins.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With Events Calendar Pro, you can add calendar content to any WordPress page or post. There are a few different methods that you can use to add a shortcode to your WordPress site, and we&#8217;ll show you how to do it below. Add a shortcode with the Block Editor To add a shortcode using the&#8230;<\/p>\n","protected":false},"author":3,"featured_media":1955565,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_swpsp_post_exclude":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"ep_exclude_from_search":false,"footnotes":""},"categories":[77],"tags":[],"stellar-product-taxonomy":[158],"class_list":["post-1954133","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-shortcodes","stellar-product-taxonomy-events-calendar-pro"],"acf":[],"taxonomy_info":{"category":[{"value":77,"label":"Shortcodes"}],"stellar-product-taxonomy":[{"value":158,"label":"Events Calendar Pro"}]},"featured_image_src_large":["https:\/\/images.theeventscalendar.com\/kb\/uploads\/2023\/02\/social-share-1024x538.png",1024,538,true],"author_info":{"display_name":"Jaime Marchwinski","author_link":"https:\/\/theeventscalendar.com\/knowledgebase\/author\/jaimetri-be\/"},"comment_info":0,"category_info":[{"term_id":77,"name":"Shortcodes","slug":"shortcodes","term_group":0,"term_taxonomy_id":77,"taxonomy":"category","description":"","parent":61,"count":12,"filter":"raw","term_order":"0","cat_ID":77,"category_count":12,"category_description":"","cat_name":"Shortcodes","category_nicename":"shortcodes","category_parent":61}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1954133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/comments?post=1954133"}],"version-history":[{"count":2,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1954133\/revisions"}],"predecessor-version":[{"id":1958819,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/posts\/1954133\/revisions\/1958819"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media\/1955565"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/media?parent=1954133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/categories?post=1954133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/tags?post=1954133"},{"taxonomy":"stellar-product-taxonomy","embeddable":true,"href":"https:\/\/theeventscalendar.com\/knowledgebase\/wp-json\/wp\/v2\/stellar-product-taxonomy?post=1954133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}