Blog

Disable WooCommerce Content on Shop Page

The WooCommerce settings provide an option to disable the shop page, but if you have a page called ‘shop’ then WooCommerce will still load the page using the products archive template:

/wp-content/plugins/woocommerce/templates/archive-product.php

This template file can be copied to your theme folder and then edited allowing the content to be changed (full details in the The Woo Themes Documentation). The file needs to be created in a folder called ‘woocommerce’ in the active theme:

/wp-content/theme-name/woocommerce/archive-product.php

This technique lets you change the content, but we wanted the page to load as if it was a normal page. To achieve this  the page content is reloaded by calling query_posts and then including the desired theme template for the page (in this case page.php):

<?php
 // override archive-product.php

 // load specific page
 query_posts('page_id=2');

 // load the page template for the current theme
 include get_template_directory() . "/" . "page.php";

 // stop any other woocommerce code executing
 exit;
 ?>

This solution (hack) is not ideal and the problem may well be resolved in a future revision of WooCommerce.

Previously the template page was named archive-template.php and this post has been updated to the newly named archive-product.php – thanks to Nancy for pointing this out.

Posted in Programming | Tagged , , | 7 Comments

Misleading ‘You have no mail’ Gmail Message While Page Loads

It’s always nice to see an empty inbox especially with the cheery ‘You have no mail. Enjoy your day!’ message in Gmail:

You have no mail!

Unfortunately though this is misleading as the message is displayed while the page is loading. This has made me laugh on a number of occasions so I’ve just believed the message and closed my email!

Posted in Everything Else | Leave a comment

Useful WordPress Plugins

Thanks to the large WordPress community there are a lot of WordPress plugins available. The downside though is that you normally have to try out a few different plugins before you find the one that meets your needs.

To save others the same pain I’ve collated the following list of plugins that I use frequently across a number of websites. Read More »

Posted in Programming | Tagged | Leave a comment

MySQL Select Columns Quirk

A long time ago I came across a quirk with MySQL that would not let you select all columns in a query  if you first specify a column name.  So executing the following SQL:

select post_title, * from posts;

Read More »

Posted in Programming | Tagged | Leave a comment

Password Generator

When creating passwords it’s usually hard to make them secure and random. To create strong passwords I use my originally named Password Generator!
Read More »

Posted in Programming | Tagged | 2 Comments

Add Request Header to jQuery Ajax Requests

Sometimes it is necessary to determine if a request was performed by a jQuery Ajax call or a normal request. Using ajaxSetup it is possible to add custom headers to all Ajax requests executed by jQuery.

$.ajaxSetup({
   'beforeSend': function(xhr) {           
      xhr.setRequestHeader("AJAX", "true");
    }
});

Server-side you can then check the request header to identify the type of request and output the appropriate response.

Posted in Programming | Tagged | Leave a comment

Make Visual Studio Run Faster

Running Visual Studio can be quite demanding on your operating system. Working on large projects with lots of files can really start to make Visual Studio freeze. I find that by turning off a lot features you can speed up the response time of Visual Studio and improve your productivity. Read More »

Posted in Programming | Tagged | 6 Comments

Unable to Open configSource File ‘connections.config’

When specifying the location of a configuration file for a .NET console application you may receive this error:

System.Configuration.ConfigurationErrorsException: Unable to open configSource file 'connections.config'

The file was being referenced as follows in app.config:

<connectionStrings configSource="connectionStrings.config" />

I suspected that the configuration file was not being copied to the ouput debug/release folder and so could not be found when running the application. This post on BlueSam Blog shows that you can set how files are copied to the output directory of the project automatically.

By viewing the properties of a file in Visual Studio there is a property called Copy to Output Directory that can be used to copy the configuration file automatically:

This solved the problem and the configuration file was loaded!

Posted in Everything Else | Tagged , | 3 Comments

Migrating From SQL Server 2008 Back to SQL Server 2005

It may seem unusual migrating from SQL Server 2008 back to SQL Server 2005, but believe me it is useful to know a few gotchas if you do find yourself in this position.

I tried many different ways to migrate back 2008 to 2005. The following steps are what has worked for me quite reliably, but I am sure there are other ways to go about this.

Read More »

Posted in Programming | Tagged | Leave a comment

Creative HTML Email With Images Disabled

When reading emails I have images disabled by default as a security measure. Disabling images prevents my emails being tracked when opening and allows me to see what efforts companies go to when promoting products or services.

One example that has stood out recently is the following email from Pizza Express luring me to eat more of their glorious pizzas:

Great use of creativity and alt text in a HTML email with images disabled

Read More »

Posted in Everything Else | Leave a comment