Posts

Showing posts from 2017

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

Wordpress Define Child Theme Thumbnail Dimensions

To define the thumbnail image dimensions for your Wordpress child theme add this function to your child theme's functions.php file if ( function_exists( 'add_theme_support' ) ) {     add_theme_support( 'post-thumbnails' );     set_post_thumbnail_size( 150, 150, true ); // default Featured Image dimensions (cropped)     // additional image sizes     // delete the next line if you do not need additional image sizes     add_image_size( 'themeName-medium', 400, 220 ); // 400 pixels wide 220 pixels high  }

Write Custom Wordpress Shortcode to use Parameters

So recently I needed to write a Wordpress Shortcode in my Child Theme's functions.php file which allows me to specify certain parameters or variables for a Gallery. If the post did not have any photos for a gallery section it would show a standard set of photos I saved on the server. If the post did have photos for the Gallery I would declare the shortcode with two additional parameters , one for total number of photos (because this runs in a PHP While Loop) and the other for the directory name where the photos are saved. In your functions.php file in your Wordpress Child Theme add this Function (change the names to your preference) function ListingGallery($atts) {   $atts = shortcode_atts( array(         'totalpics' => '10', 'imgdir' => 'general',   ), $atts );      ob_start();      $output_string = ' <h1 class="entry-title">Gallery</h1> <div align="center"