Restoring VVV functionality to Pressmatic

I switched from developing using Vagrant with VVV to using the new Mac app Pressmatic. I’ve been very happy, and so has my Mac—the dev environment runs much faster and my computer has been working a lot less. Less fan noise is good.

The server environment that Pressmatic uses don’t have some basic stuff that I needed to maintain compatibility with my setup. This is a running list of items that I’ll update as I come across more requirements:

  • wget
  • Subversion
apt-get install wget subversion curl php5-cli git
apt-get update

To set up unit testing, we’ll need to do a few more things. The following are taken from Tom McFarlin’s great article on unit testing with Pressmatic.

# Make sure required libraries are installed
apt-get install curl php5-cli git

# Install Composer
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Tell Composer what version of PHPUnit to run
composer global require "phpunit/phpunit=4.8.*"

# Tell the server where to find Composer
export PATH="$PATH:$HOME/.composer/vendor/bin"

Oh My Zsh!

I love Oh My Zsh; it’s a simple way to make your shell console a lot better. A big must-have for me is improved directory navigation: I don’t want to prefix changing directories with cd [...]; just let me type ../!

Here’s the code to install it:

apt-get install zsh

# Install oh-my-zsh
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Then restart your console and you should be running Zsh. If not, type zsh.

Set the Width for a Google Maps InfoWindow

Working with Google Maps v3 is way fun.

If you’re a masochist.

Infowindow width
Scrolling InfoWindow
It seems like there’s no easy way to set the width of an InfoWindow. You can set the minWidth parameter, but that does nothing.

If you have content that exceeds the InfoWindow window, you get this: a scrolling box. That’s terrible.

The solution is horribly easy.

Looking Through the InfoWindow
The solution presents itself.
This will solve all your problems, and make you wish you had the past two hours back of your life: use the provided .gm-style-iw class to style the InfoWindow content container.

/* Just use .gm-style-iw */
.gm-style-iw {
width: 300px; 
min-height: 150px;
}

Get URL for Searches in Safari 6

There have been many articles and conversations about the question of how to get the URL of a Google search in Safari 6. Some solutions include using the Terminal to get the URL, using AppleScript,  using bookmarklets, and using Automator. I created a Safari Extension to make this process easier.

Get URL: Easily get the URL of your current tab.

With my Get URL Safari Extension, simply click the toolbar button for a popup that contains the URL of the current page. The URL is already selected, making it simple to copy.

Download the Get URL Safari Extension
(.safariextz, 46 kb)

Update: I’ve received notice from Apple that the extension will be available in the Safari Extensions Gallery. Look for it there soon!

Add Googlebot User Agent to Safari Develop Menu

Googlebot Safari

If you’re like me, you’ve wanted to have the Googlebot user agent availalbe in the Develop menu of Safari.

  1. Go to /Applications/
  2. Right-click on Safari.app and select Show Package Contents
  3. Navigate to Contents/Resources/
  4. Find `UserAgents.plist`
  5. Open `UserAgents.plist` in your favorite text editor
  6. Either
    • Replace with the contents of this file and continue to step 9: [download id=”12″]
    • … or continue on:
  7. At the end of the file, find:
    </array>
    </plist>
  8. Replace with:
    	<dict>
    		<key>separator</key>
    		<true/>
    	</dict>
    	<dict>
    		<key>name</key>
    		<string>Googlebot</string>
    		<key>version</key>
    		<string>2.1</string>
    		<key>platform</key>
    		<string>Googlebot</string>
    		<key>user-agent</key>
    		<string>Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)</string>
    	</dict>
    	<dict>
    		<key>name</key>
    		<string>Bing</string>
    		<key>version</key>
    		<string>2.0</string>
    		<key>platform</key>
    		<string>Bingbot</string>
    		<key>user-agent</key>
    		<string>Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)</string>
    	</dict>
    </array>
    </plist>
    
  9. Save the file (you’ll need to type in your user password)

Voila! Now in your Safari Develop > User Agent menu, you should see `Googlebot 2.1 – Googlebot` and `Bing 2.0 – Bingbot`.

Generate a Link to Activate a Plugin in WordPress

Here’s another specialized plugin development tip!

If you want to create a link to activate a plugin, you need to know the path of the plugin file. Let’s use Akismet for this example.

$path = 'akismet/akismet.php';
$link = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$path), 'activate-plugin_'.$path);

The `$link` URL will be something like http://yoursite.com/wp-admin/plugins.php?action=activate&plugin=akismet%2Fakismet.php&_wpnonce=f97dabdf9

How to Hard-Code a UA String for the Google Analytics for WordPress Plugin

If you want to define a Google Analytics “UA String” while using Yoast Google Analytics plugin for WordPress.

Add the following to your theme’s `functions.php` file:

add_filter( 'option_Yoast_Google_Analytics', 'custom_ua_string_filter');

function custom_ua_string_filter($options = array()) {
	$options['uastring'] = 'UA-########-#';
	$options['manual_uastring'] = true;
	return $options;
}

For users of WordPress Multisite, this will allow you to pre-configure new blogs with the same UA string.

Simple Way to Get Plugin Status in WordPress

Active plugin volcano.

I have previously written on how to determine if a widget is active. This is helpful for widgets, but not for plugins.

WordPress has a couple of different functions that help you determine plugin status. They are both located in wp-includes/plugin.php

  • `validate_plugin()` spits out an error if the plugin file does not  exist or has an invalid header. This lets you know that the file is there.
  • `is_plugin_inactive()` lets you know if the plugin is not active (using the `is_plugin_active()` function)

A function to get plugin status

Using these two functions, I put together a one-size-fits-all function `get_plugin_status()`. Continue reading “Simple Way to Get Plugin Status in WordPress”

A WordPress Developer's Tips for Using Panic Coda

Panic CodaI use Panic Coda for coding. I like its Mac-style interface and it “fits” me well. There are some items that are frustrating, including a lack of auto-complete for functions you’ve already used in your code. Here are three tips to improve your coding experience. Continue reading “A WordPress Developer's Tips for Using Panic Coda”

Yourls Google Analytics Link Tagging

In my last post, I wrote about the benefits of using YOURLS, a self-hosted link-shortening service. I’m finding that YOURLS is great, but it’s not perfect. Some of the issues I have experience are part of what you get using most URL shortener services.

Some of the downsides of using link shorteners are:

  1. Google Analytics doesn’t always capture the original referrer (and I have no clue how they do the rest of the time!).
  2. When generating links using the bookmarklet (or in this case, also the Yourls installation), there’s no easy way to add campaign, source, medium, content, and term tags for Google Analytics to track.
  3. Yourls doesn’t allow query strings on URLs by default, making overriding existing campaign tags difficult/impossible. For example: `http://katz.si/t?utm_source=2300`

I’m not the only one who wanted these things, so I’ve created a plugin that adds Google Analytics tracking to Yourls. It’s very cool.

Continue reading “Yourls Google Analytics Link Tagging”

YOURLS URL Shortener

YOURLS LogoI was having trouble finding the right URL shortening service. My requests for shortening were not too picky. I wanted two simple features:

  • Good statistics that are visible only to administrators
  • Edit the long URLs after generating shortened links

…but not one service has both features:

  • http://sn.im has editable URLs, a bookmarklet, but no stats. Oh, and they kept on deleting my links.
  • http://bit.ly has great stats, name recognition, but the links aren’t editable and the stats are public.
  • http://goo.gl is the fastest service (so they claim), they have good stats (maybe the best, since they include OS & browser information), but they don’t have editable links or private stats.

Other smaller offerings may have had both features, but they also seem unreliable. I wanted control of my links. Continue reading “YOURLS URL Shortener”

Enable PDF Uploads in CubeCart 4

No swimming, no file uploads in CubeCart either!The CubeCart file and image uploader in the product editor only allows for a small set of file types: jpg, gif, jpeg, png, swf, fla, jpg, gif, jpeg, png, avi, mpg, and mpeg. If you want to upload a PDF in CubeCart, you will have to manually FTP it into the uploads folder, and even then the file browser won’t show you PDFs. If you try to upload PDFs, you’ll get the following alert: “Invalid file type.”  Well here’s how to fix that. Continue reading “Enable PDF Uploads in CubeCart 4”

WordPress.org Changes Plugin Page Layout

WordPress.org plugin page layout change likely for usability

Wordpress.org plugin page from 2008
What the WordPress.org plugin page used to look like.

A couple of weeks ago, WordPress.org changed the layout of their plugins directory plugin pages. The update was likely to improve usability for users trying to determine whether a plugin is trustworthy and what it does. I believe the re-arranging of the page has achieved those goals.

The update removes author links

The layout redesign removes links to the official plugin page. I believe this makes it more difficult for users trying to get support on plugins.

Removing links also affects plugin authors. One of the ways that plugin authors are “rewarded” for creating plugins used to be a link from the WordPress.org website. This resulted in two things: increased traffic to the author’s website and some passed SEO value from the WordPress website to the author’s website.

I recommend all authors to go back through their readme.txt files and add a link to their support pages. Continue reading “WordPress.org Changes Plugin Page Layout”

How to Add www. – or Remove www. – From Your URL

This has been done many times by others, but just a quick tip on how to add or remove www. from your website’s address. This is helpful for URL canonicalization and user experience consistency. You can also achieve SEO-friendly canonicalization using rel="canonical". Oh boy, I’m getting too technical 🙂

Here’s the juicy part:

Add the following to the .htaccess file in your website’s root folder (often named public_html or www). If there’s not a file named .htaccess, you may create it. If you are creating the .htaccess file, set the permissions to 644. For security reasons, you don’t want others to be able to write to this file. Continue reading “How to Add www. – or Remove www. – From Your URL”

Save Coding Time by Creating Special-Case Categories in WordPress

When you would use excluded categories:

When using WordPress as more of a content management system (CMS) than a blogging platform, there are many things that you need control over. One of them is special-case categories.

  • Frequently asked questions
  • Testimonials
  • Case studies
  • Press releases

When you have a category of posts that you don’t want to have comments, publishing dates, post author, etc., you can define a list of excluded categories. In most cases, you should use Category Templates to achieve this functionality, but that is not always practical or the best option. Continue reading “Save Coding Time by Creating Special-Case Categories in WordPress”

Redirect a Website in ColdFusion – Add www. or Move to New Domain

ColdFusion, BabyRedirecting a website in ColdFusion (.CFM)

I have been working on a ColdFusion website, and I wanted to find a way to require ‘www.’ in the URL (to consolidate all pages on www. for SEO). I normally work with PHP and Apache servers, so I’m used to .htaccess. I knew there had to be a way.

Here’s a simple method of redirecting a whole website in ColdFusion:

<!-- If the site isn't www... -->
<cfif (CGI.SERVER_NAME NEQ "www.example.com")>
<!-- Save the URL (and $_GET variables too) as the string 'strUrl' -->
<cfset strUrl = CGI.script_name & "?" & CGI.query_string />
<!-- Use 301 for SEO-friendly redirects -->
<cfheader statuscode="301" statustext="Moved permanently">
<!-- Redirect to new website (this case, added www.) with strUrl added on -->
<cfheader name="Location" value="http://www.example.com#strUrl#">
</cfif>

Continue reading “Redirect a Website in ColdFusion – Add www. or Move to New Domain”

How to Tell if Your WordPress Widget is Active

Check your  widget activation & settings

Also, How to Check Plugin Status

Ever wonder if your widget is activated on an external site?

Here’s how to find out.

When you register a sidebar widget, you use code like this:

register_sidebar_widget(array('Name of Widget', 'class-of-widget'), 'widget_function');

If you want to check whether the widget is activated (you may want to for a variety of reasons), you can do it like this (the “class-of-widget” value from above will be used in the code below): Continue reading “How to Tell if Your WordPress Widget is Active”

Career-Magic.com Launched

New CareerMagic Website Design

An updated website for a Denver career coach

CAREERMagic came to Katz Web Design to give their website some fresh blood.

When Career-Magic.com was last updated, I was in high school.  Yes, it’s true — and I said it. The website not only needed updating visually, but there were a lot of parts of the website that needed to be better integrated with how the business ran.  The new Career-Magic.com website launched last night. Continue reading “Career-Magic.com Launched”

Recover your password from Interspire Shopping Cart

Where did my Interspire password go?
I develop my websites locally, so sending Lost Password emails never works. When I forget what my password is, it’s quite the hassle.

I’m developing an Interspire Shopping Cart website, and lo and behold, I lost the password.

Here’s how to recover your password from Interspire Shopping Cart: Continue reading “Recover your password from Interspire Shopping Cart”

Standards-Compliant Shopping Cart with XHTML & CSS!

I’ve been looking for a shopping cart like this for a long time

One of my clients is looking to move from osCommerce to a more user-friendly solution, and I really want to use a shopping cart that is XHTML and standards-compliant…Something that validates and looks pretty with stylesheets off, has a full feature set, and a great admin panel.

I was quite pleasantly surprised when I discovered Tradingeye. They have a well-coded shopping cart solution as well as a CMS. Very, very interesting.  Looks like a pleasure to develop for; like WordPress for eCommerce. Check out their Shopping cart demo. Continue reading “Standards-Compliant Shopping Cart with XHTML & CSS!”