Posts

Showing posts from September, 2018

How to Display Custom Wordpress Header with Google Analytics Site Tage and Adwords Site Tag

This post assumes you know how to create custom page templates in Wordpress using child themes. Locate this line of code in your page template (page.php) get_header(); Download the header.php file from the parent theme folder into your child theme folder Rename the header.php file you downloaded to header-with-analytics.php Change the get_header function in your page template to include the custom header file. In the brackets add the custom header filename like this get_header("with-analytics"); Everything after the header- in the filename is what you place between the brackets. Save and upload the custom header PHP file. Upload your modified page template file (page.php) Now the page template will load your custom header file called header-with-analytics.php Place your Google Analytics Site Tag or Google Adwords Conversion Tracking code in this header-with-analytics.php file as per Googles instructions.

How To Add Wordpress Shortcode to PHP Template File

If you're trying to add a Wordpress Shortcode to your custom theme page template you will find that outputting the shortcode in HTML won't work like this: <p>[shortcode here]</p> You will need to use the Wordpress function do_shortcode. This will work <?php echo do_shortcode('[shortcode_here]'); ?>