How to Add a Shortcode of Another Plugin (Like Open Maps) to the Header of a WordPress Homepage
Shortcodes in WordPress allow you to insert dynamic content generated by plugins into different sections of your website. However, by default, shortcodes are mostly used inside posts, pages, and widgets. If you need to add a shortcode (such as one from an Open Maps plugin) to the header of your homepage, you can achieve this with and without a plugin. This article will walk you through both methods.
Method 1: Using a Plugin
If you prefer a plugin-based approach, you can use a custom code plugin like Insert Headers and Footers or Code Snippets to safely add the shortcode to your theme’s header.
Steps to Add a Shortcode Using a Plugin:
- Install a Plugin:
- Go to
Plugins > Add Newin your WordPress dashboard. - Search for “Insert Headers and Footers” or “Code Snippets.”
- Install and activate the plugin.
- Go to
- Insert the Shortcode into the Header:
- If using Insert Headers and Footers:
- Navigate to
Settings > Insert Headers and Footers. - In the “Header” section, add the following PHP shortcode execution snippet:
<?php echo do_shortcode('[your-shortcode]'); ?> - Replace
[your-shortcode]with the actual shortcode provided by the Open Maps plugin. - Save changes.
- Navigate to
- If using Code Snippets:
- Navigate to
Snippets > Add New. - Add the following PHP snippet:
function add_shortcode_to_header() { echo do_shortcode('[your-shortcode]'); } add_action('wp_head', 'add_shortcode_to_header'); - Save and activate the snippet.
- Navigate to
- If using Insert Headers and Footers:
Method 2: Without a Plugin (Manually Editing Theme Files)
If you prefer not to use a plugin, you can directly modify your theme’s header.php file or use a functions.php hook to insert the shortcode.
Steps to Add Shortcode by Editing header.php:
- Backup Your Website: Before making any changes, create a backup to avoid breaking your site.
- Locate and Edit
header.php:- In the WordPress dashboard, go to
Appearance > Theme Editor. - Open
header.phpfrom the right-side list. - Find a suitable place where you want the shortcode to appear (e.g., before
</head>or inside a<div>in the header). - Insert the following code snippet:
<?php echo do_shortcode('[your-shortcode]'); ?> - Save the changes and refresh your homepage.
- In the WordPress dashboard, go to
Steps to Add Shortcode Using functions.php:
- Go to
Appearance > Theme Editorand openfunctions.php. - Add the following code snippet at the end of the file:
function add_shortcode_to_wp_head() { echo do_shortcode('[your-shortcode]'); } add_action('wp_head', 'add_shortcode_to_wp_head'); - Save changes and refresh your website to see the shortcode output.
Conclusion
Both methods allow you to add shortcodes (such as Open Maps) to the header of your WordPress homepage. Using a plugin is safer for beginners and avoids modifying theme files, whereas the manual approach provides more control but requires careful handling. Choose the method that best suits your needs!

In some cases, it may be possible to negotiate the price of a premium domain. However, the success of negotiations depends on factors such as the domain's demand, the seller's willingness to negotiate, and the overall market conditions. At BrandBucket, we offer transparent, upfront pricing, but if you see a name that you like and wish to discuss price, please reach out to our sales team.
How Do I Transfer a Premium Domain?
Transferring a premium domain involves a few steps, including unlocking the domain, obtaining an authorization code from the current registrar, and initiating the transfer with the new registrar. Many domain name marketplaces, including BrandBucket, offer assistance with the transfer process.



