{"id":11862,"date":"2024-05-05T10:10:25","date_gmt":"2024-05-05T10:10:25","guid":{"rendered":"https:\/\/hostvento.com\/kb\/web-hosting\/getting-started-guide\/shared-hosting-quick-start-guide\/managed-wordpress-quick-start-guide\/discover-the-steps-to-use-wordpress-do_shortcode\/"},"modified":"2024-06-16T15:32:14","modified_gmt":"2024-06-16T15:32:14","slug":"discover-the-steps-to-use-wordpress-do_shortcode","status":"publish","type":"docs","link":"https:\/\/www.hostvento.com\/kb\/docs\/hosting-faqs\/discover-the-steps-to-use-wordpress-do_shortcode\/","title":{"rendered":"Discover the Steps To Use WordPress do_shortcode"},"content":{"rendered":"\n<p>Using shortcodes, you may quickly increase the functionality of your website. With WordPress&#8217; do_shortcode function, you can add shortcodes to any area of your website. This article will demonstrate its application. Let us begin by learning the fundamentals of shortcodes!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">What Exactly is Shortcode?<\/h3>\n\n\n\n<p>A shortcode is a bit of code that lets you execute an action, like showing content. For example, to display a slider created using the MetaSlider plugin, you must insert the plugin&#8217;s shortcode into your website.<\/p>\n\n\n\n<p>But, you can only embed it on the site\u2019s body or widget or else, the content won\u2019t get displayed. For resolving this issue, you can use WordPress do_shortcode function. By using it you can embed the shortcode anywhere you want \u2013 including the header. It looks as below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&lt;?php echo do_shortcode( '[your shortcode goes here]' ); ?&gt;<\/pre>\n\n\n\n<p>To apply this function, go to the theme files and tweak them. Ensure that you take a complete backup of your WordPress site and use the WordPress child theme in advance to avoid data loss if anything goes wrong.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Steps to Use WordPress do_shortcode<\/h3>\n\n\n\n<p>Now, let\u2019s try to add a shortcode using WordPress&nbsp;<strong>do_shortcode<\/strong>. For instance, suppose you want to add a slider in your theme\u2019s header using&nbsp;<strong>MetaSlider<\/strong>&nbsp;\u2013 ensure you\u2019ve installed the plugin. However, there is no widget for the header area.<\/p>\n\n\n\n<p>Therefore, you need to embed the shortcode of the slider to the theme\u2019s header file. For this, follow the below steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Click on\u00a0<strong>MetaSlider<\/strong>\u00a0located on the left sidebar of the WordPress admin dashboard.<\/li>\n\n\n\n<li>Go to the bottom right of the page and copy the\u00a0<strong>shortcode<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p>If the MetaSlider\u2019s shortcode is already present within the WordPress&nbsp;<strong>do_shortcode<\/strong>&nbsp;function then edit the theme\u2019s header file by going to your hosting provider\u2019s file manager or an FTP client like&nbsp;<strong>FileZilla<\/strong>.<\/p>\n\n\n\n<p>The below steps will show you the steps to edit theme files with Hostvento\u2019s file manager \u2013 it can be applied in an&nbsp;<strong>FTP<\/strong>&nbsp;client as well:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Hover to your cPanel and click on\u00a0<strong>File Manager<\/strong>.<\/li>\n\n\n\n<li>Navigate to the\u00a0<strong>public_html<\/strong>\u00a0folder and move to\u00a0<strong>wp-contents -> themes<\/strong>.<\/li>\n\n\n\n<li>Find and go to your currently active theme folder.<\/li>\n\n\n\n<li>Open\u00a0<strong>header.php<\/strong>, then scroll down the page and add the\u00a0<strong>do_shortcode<\/strong>\u00a0function above the tag.<\/li>\n\n\n\n<li>Save and check your website appearance.<\/li>\n<\/ol>\n\n\n\n<p>Sometimes when you edit theme core files, it can break your WordPress template. For this, you should alter the CSS to improve your website\u2019s appearance.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p>This has taught you how to utilize the WordPress do_shortcode function to show shortcodes. To get started, simply include the shortcode into the theme&#8217;s file! To reduce the chance of losing data, always make a backup of your website before making any changes to the file.<\/p>\n\n\n\n<p>If you have any questions regarding the topic, drop a comment below!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Using shortcodes, you may quickly increase the functionality of your website. With WordPress&#8217; do_shortcode function, you can add shortcodes to any area of your website. This article will demonstrate its application. Let us begin by learning the fundamentals of shortcodes! What Exactly is Shortcode? A shortcode is a bit of code that lets you execute [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":23377,"menu_order":194,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-11862","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/11862","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/comments?post=11862"}],"version-history":[{"count":2,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/11862\/revisions"}],"predecessor-version":[{"id":11865,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/11862\/revisions\/11865"}],"up":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/23377"}],"wp:attachment":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/media?parent=11862"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/doc_tag?post=11862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}