An Easy Way to Customize a WordPress Template File

Sometimes you just need to tweak a theme’s template file in order to add custom elements not made available by the customizer or theme options. If you’re not comfortable modifying a template’s php code, try using a sweet little plugin called ‘amr shortcode any widget’. This plugin basically allows you to make a shortcode out of any widget then insert it into any page, post, or php template file.

In my case, I needed to add a phone number and a call to action button into a theme’s header file. Unfortunately, the theme itself did not provide an option to do this. Fortunately, I found a plugin entitled ‘amr shortcode any widget’ that provided the solution!

Using this plugin, here are the steps I took to achieve the desired affect in the header.


First, install and activate the plugin.
Next, go to widgets and find the new section called Widgets for Shortcodes.

Add the desired widget to this section (in this case, I used the Custom HTML widget to add phone and button shortcode). Save.






Next, find the widget ID that will be placed in a shortcode.

1. Open Appearance->Widgets
2. On top of the screen, find “Screen Options” and open it
3. Click on “Enable Accessibility Mode”
4. Find the widget for which you want to know ID and click the “Edit” button







Using the shortcode, I inserted this tag into the header.php file to achieve the desired result.








Keep in mind this type of change will be overwritten when the theme is updated, so be sure to use a child theme, or keep a copy of the file modification to re-add after updating the theme.










Comments are closed.