Posts

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]'); ?>

Eliminate render-blocking JavaScript and CSS

If you use Googles neat PageSpeed Insights tool found here ( https://developers.google.com/speed/pagespeed/insights/ ) you will most likely encounter an optimization suggestion to Eliminate render-blocking JavaScript and CSS in above-the-fold content You can do this by using something called a Critical Path CSS generator Why use this? Without these tweaks a user will see a blank web page when accessing your site in the seconds it takes to render the stylesheets and HTML A Critical Path CSS Generator takes your CSS file contents and filters out the styles needed to load first. Ok, so what do I do then? You simply copy this filtered styles and minify them on www.minifier.org This minifier online tool removes whitespace, strips comments, combines files, and optimizes/shortens a few common programming patterns. You then paste that "minified" code between the <head></head> tags of your webpage with the <style></style> tags But you're

PHP Mail script to deliver HTML Form data

In your form settings set your action as your link to PHP acript handling the data and your method as POST $name = $_POST['name']; $from = $_POST['email']; $d8time = date("d/m/Y H:i:s"); $to = "brendan@br3nd4nc.blogspot.com"; $subject = "Website Enquiry $d8time"; $headers   = "From: $name <noreply@br3nd4nc.blogspot.com>\r\n";  $headers .= "Content-type: text/html;charset=UTF-8\r\n"; $headers .= "Reply-To: $from\r\n"; $message = "Hello World"; $confirm = mail($to,$subject,$message,$headers); if ($confirm) { print "<script>window.location.replace('http://br3nd4nc.blogspot.com');</script>\n"; } else { print "<h2>Error</h2>"; $errorMessage = error_get_last()['message']; print $errorMessage; //print phpinfo();   }

Complete Uninstall iTunes on Windows 7 Pro 64-Bit

Recently I had an issue with my 64-bit iTunes software on my Windows 7 Professional notebook. iTunes could not be updated to the latest version and I constantly got this error message  "There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor." I tried uninstalling iTunes on my PC and re-installing with the same issue. It seems you need to uninstall a few software components related to iTunes. I did this and re-installed iTunes 64-bit on my Windows 7 Pro notebook successfully. Go to your Control Panel and choose "Uninstall a Program" or search the Control Panel (on the top right) with the term "uninstall" to locate the link Uninstall these software components in this exact order to avoid potential issues (as recommended on the Apple website) iTunes Apple Software Update Apple Mobile Device Support Bonjour Apple Applicati

Editing Existing Theme Function in your Child Theme's functions.php file

By default WordPress assigns a priority of 10 to functions which haven't had a priority added, so to display your function after it you use a number larger than 10 for example 15 like so <?php function child_function() {     // Contents for your function here. } add_action( 'init', 'child_function', 15 ); ?>

Enqueue Stylesheet or Javascript on just one Wordpress Page or Post

To enqueue a css stylesheet or external javascript file on just one page use the following function with a conditional if statement in your child theme functions.php script. function register_online_form_style() {   if ( is_page( '104' ) ) {     wp_enqueue_style( 'contactForm', get_stylesheet_directory_uri() . '/site/css/form.min.css' );   } } add_action( 'wp_enqueue_scripts', 'register_online_form_style' ); 104 is the page or post's ID contactForm is the name of the script Pretty starightforward