Archive for the 'Web Development' 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 [...]

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 [...]

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 [...]

Add ‘Related Products’ to the Product Template in the Shopp WordPress Plugin

Problem: Today I needed to add some code to a Shopp (ver 1.1.9) product.php template so that related products (that have same ‘Tag’) would show up at the bottom. The ‘Related Products‘ template tag was not behaving as I expected it to.. i.e. it was stopping the product page rendering anything at all. Fix: After chatting to some [...]

Launch Google Chrome Incognito from the terminal or a shortcut in OSX

Problem: Ok not really a problem, but I want to be able to launch Google Chrome straight to Incognito mode from a shortcut. This is useful when logging into multiple bank accounts, Google Apps accounts, or testing session based websites. etc etc etc. Fix: Thankfully the Google Chrome.app can be launched with the –incognito switch [...]