Archive for the 'Computers' Category

Remove Links menu item in WordPress

Problem: I’m customising a WP install for a client, adding some Custom Post Types and wotnot, and they aren’t going to have any need for the Links thing. Fix: Adding this to your theme’s (or child-theme’s) functions.php removes the page and the menu link: function nuke_menu_items(){ remove_menu_page( ‘link-manager.php’); //remove_menu_page( ‘upload.php’); //remove other items etc etc [...]

Searching between dates in GMail

Problem: I’m doing my tax return And need to frequently look for emails sent and received in the 2010/11 tax year. Fix: Gmail is really powerful when the text search box is used. There are various advanced search operators but the ones that help here are ‘before:’ and ‘after:’. When twinned with ‘from:’ or ‘to:’ it returns [...]

Adding category depth tag to Shopp 1.1.*

Problem: I needed to display sub categories of a category in category.php but only one level deep. Using: <?php if(shopp(’category’,'hascategories’)): ?> <?php while(shopp(’category’,'subcategories’)): ?> //display stuff <?php endwhile; ?> <?php endif; ?> …displays all subcast AND their subcats. Fix: I decided to add a new tag, called shopp(‘subcategory’, ‘depth’) that would return the category depth. [...]

Getting subcategory totals [shopp('subcategory','total')] to work in Shopp Plugin 1.1.*

Problem: Pulling the total number of products from a subcat in Shopp doesn’t seem to work out the box. For example, this code WON’T return the total even though the correct tag shopp(‘subcategory’,’total’) is used: <?php while(shopp(’category’,'subcategories’)): ?> <?php shopp(’subcategory’,'name’); ?> (<?php shopp(’subcategory’,'total’); ?>) <?php endwhile; ?> Fix: For the products to be countable, the [...]

Remove prices from Variation drop-downs in Shopp WordPress plugin

Problem: In Shopp (1.1.9) the default variations drop-down list shows prices. This isn’t always desired. This is the default usage: <ul class="variations"> <?php shopp(’product’, ‘variations’, ‘mode=multiple&label=true&defaults=Select an option&before_menu=<li>&after_menu=</li>’); ?> </ul> And this outputs a list that shows options as “Option Label (price)”. Fix: The code above can be replaced with this code to manually create [...]

Capture last viewed category in product view in Shopp Plugin for WordPress

Problem: I’m using the Shopp 1.1.9 ecommerce plugin for WordPress, and my client wanted to display specific background images while showing certain products. Shopp is very complete, but one thing that is missing in the current version ‘out of the box’ is the ability to pull the ‘last viewed’ category name when viewing a product. [...]

What is Notice: unserialize() [function.unserialize]: Error at offset then?

Problem: While doing some Shopp Plugin support work earlier, one customer was getting this error… Notice: unserialize() [function.unserialize]: Error at offset 111 of 118 bytes in /home/maxwell4/public_html/main/wp-content/plugins/shopp/core/model/Settings.php on line 228 …she had done a ‘find and replace’ in a SQL DB dump to change her domain name, boogered it up accidentally, and needed an explanation. [...]

.htaccess hidden on Rackspace Cloud Sites (in FTP, with Filezilla)

Problem: When connecting to a Rackspace Cloud site via FTP, hidden files are.. uh.. hidden. Usually Filezilla shows everything. Fix: There is a setting in Filezilla called ‘Force showing hidden files’ that does exactly that. To activate that, go to the ‘Server’ menu item and select it. Like this: When you click that, you should [...]

New Experts Exchange on the way…

So.. there’s a new version of EE available, and I want a free geek-shirt! Have a looky at this linky…

Set date.timezone in PHP without using php.ini

Problem: I needed to set default timezone for a site to get Zen Cart installed. The usual way would be to call date_default_timezone_set from a globally included script, or to use the date.timezone option in a php.ini file. The problem is that I don’t have access to the php.ini file and there is no script that [...]