WP Gallery Image Shortcode Plugin

I just released my first WordPress plugin – the WP Gallery Image Shortcode plugin.  This plugin lets you add an image to a post or page from the WordPress gallery on your site using a shortcode.  Normally when you add an image, it embeds an image tag and sometimes an anchor tag that each includes your site URL.  This might be fine for some sites, but if you ever need to move or copy content from one URL to another, these yet more places that you must modify to get that content working in the location.

I finally got tired of it and wrote this plugin.  It allows you to use a shortcode in your posts and pages that refer to uploaded images by ID, name, or title.  The easiest is probably by title since that is what is displayed in the admin panel.

The plugin is being hosted by the WordPress plugin repository.  Check it out and let me know what you think.


Comments Off on WP Gallery Image Shortcode Plugin

Tynt Insight

I stumbled upon a service that allows you to know what’s being copied from your site.  The service can add attribution to the copied text which can drive more traffic to your site.  The service is called Tynt Insight and the basic functionality is all free, but they offer additional features in a Pro package for a fee.

Here are some comics that describe some of the features.




I’m trying this out now on my site.  I’d be interesting to hear what others think about it.

Related posts

Comments (2)

PowerShell version of dir /s and the -Recurse parameter

My colleagues and I ran into a bit of a problem trying to find all the files that matched a pattern at or below the current folder.  The problem is that the PowerShell Get-ChildItem cmdlet has a bizarre notion of file and path matching.  Consider this cmd.exe command:

dir /s Microsoft*

This will return all the files that begin with the word Microsoft at or below the current directory.  You might think the following PowerShell command would do the same thing:

Get-ChildItem Microsoft* -Recurse

Well, guess again.  That returns all the contents of all the folders that begin with the word Microsoft.  Huh?  When do you ever need to do that?  Okay, maybe someone needs to do that sometimes, but for that to be the default is mind-boggling.  Try this instead:

Get-ChildItem -Include Microsoft -Recurse

This command does the same thing as the above cmd.exe command.  It’s rather bizarre why that isn’t the default when recursing, but at least there is a fairly low-cost way to do it.


Comments Off on PowerShell version of dir /s and the -Recurse parameter

Editing applicationHost.config on 64-bit Windows

I’m coming up to speed on IIS7 on Windows Server 2008 R2.  There is a lot to like, but there is also a lot to learn.  One of the things that’s interesting about R2 is that there is no 32-bit version, so I’m finally running 64-bit Windows.  This doesn’t come without its problems.

One of the problems I’m running down required that I view and possibly edit applicationHost.config.  This file is located at %SystemRoot%\System32\inetsrv\config.  Seems simple enough.  I was able to find it from the command line easily, but when I went to load it in my favorite editor (Notepad++) I got a file not found error.  Turns out that the System32 folder is redirected for 32-bit applications to SysWOW64.  There appears to be no way to view the System32 folder using a 32-bit app.  Go figure.

Fortunately, 64-bit versions of Windows ship with a 64-bit version of Notepad.  As much as I dislike it, at least it works.

Rick Strahl wrote a terrific article covering this issue, which I’ve listed in the Resources section.


Comments (6)

Regenerating WordPress Thumbnails

I’m in the process of moving my WordPress sites to a new server and a new version of WordPress, and as part of that I’m also reevaluating how my uploads are organized. I discovered that some of my images didn’t have thumbnails generated in the right sizes.

Fortunately, I’m not the only person who has run up against this problem.  Alex, otherwise known as Viper007Bond, wrote a handy plugin called, appropriately enough, Regenerate Thumbnails. This plugin couldn’t be much simpler. After unzipping it into a folder below your plugins folder and then activating, go to Tools > Regen. Thumbnails and click the button.

Nice. Simple. Elegant.

Comments Off on Regenerating WordPress Thumbnails

“Location is not available” on Windows Server 2008

I’ve just recently added a Windows Server 2008 R2 machine to my network with a domain controller running Windows Server 2003 SBS.  Everything seemed to be working fine for a couple days (not sure why it lasted that long) when I started getting an error message like this:

The system detected a possible attempt to compromise security. Please ensure that you can contact the server that authenticated you.


A search on the Internet turned up a solution on Microsoft’s support website.  The article says that the KB content has been retired, but the solution worked for me.

The article says that the problem occurs because the network firewall filters Kerberos traffic.  The solution is to open up port 88 for both TCP and UDP.  This solved the problem for me.

Note that on previous versions of the firewall it was a LOT easier to open up a port.  On Windows Server 2008 R2, here is what you have to do.

  1. In Server Manager navigate to Configuration -> Windows Firewall with Advanced Security -> Outbound Files.
  2. Click New Rule.
  3. Select Port and click Next.
  4. Select TCP and Specific remote ports, type 88 for the port number, then click Next.
  5. Click Allow the connection and click Next.
  6. Select the network profile you want to allow this for then click Next.
  7. Type a name (such as Open Kerberos Traffic (TCP)), then click Finish.

Do the same thing for UDP and you should be done.


Comments Off on “Location is not available” on Windows Server 2008

Copying a WordPress Blog to a Different Domain

Periodically I need to copy the contents of a log to another domain for testing purposes.  WordPress doesn’t make this particularly easy as it embeds the complete URL of the site in many places, including the options table, in the posts table for each post, and even in posts, such as when media is added.

There is no need to create the blog in the new database. If you’ve already done that, I would recommend deleting the tables before continuing.

Before you move on, you’ll want to back up your blog.  There are plenty of solutions for this, but a handy one that I’ve been using is WordPress Database Backup by Austin Matzko.

Now you can import the resulting backup file against the destination blog’s database.  I use phpMyAdmin for this, so here are the steps for doing that:

  1. Log in to phpMyAdmin.
  2. Select the destination blog’s database.
  3. Click the Import tab.
  4. Click the Browse button and find the .sql file that was the result of the backup operation.  If your backup produces a .zip or .gzip file, that will work fine also.
  5. Click the Go button.

You now have your content over on the new site, but you still have work to do.  You still need to change all references to the old domain to be the new domain.  There are three SQL commands you need to execute to do this.  To execute a SQL command, select the database in phpMyAdmin and click the SQL tab.  Paste the following commands into the edit box and change old-domain and new-domain as appropriate.  If you changed your table prefix, don’t forget to change the names of the tables as well.

First let’s fix the wp_options table.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

Now let’s fix the guid column in the wp_posts table.

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

Finally let’s fix the content in the wp_posts table.

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

The final step will be to copy any files that were uploaded, such as in the wp-content\files directory.


Comments (1)

Troubleshooting on IIS7

I’ve been setting up WordPress on Windows Server 2008 R2 lately and as part of trying to understand the issues fully – by installing, uninstalling, installing, etc., the last time through I forgot to create the database and the SQL user for WordPress. Unfortunately, when I connected to my website, all I got was the following error page:

Internal_Server_ErrorNo matter how I modified my WordPress configuration file, I couldn’t get anything more to be displayed, and none of the log files (PHP or IIS) contained any additional information.  Turns out this is a security feature of IIS7 to prevent details of the web server (such as folder locations, etc.) from being displayed publicly.  The solution is simple, if somewhat obscure.

To get IIS to display more detailed information, you must run the Configuration and change a setting.  Here are the steps:

  1. From Internet Information Services (IIS) Manager (hereafter called IIS Manager), click on the website you are having trouble with in the tree view to the left.  If you click on the server, your changes will apply to all websites.
  2. In the Management section, double-click on Configuration Editor.
  3. In the dropdown list next to the Section label, select system.webServer –> httpErrors.
  4. Change the errorMode to Detailed.

It’s likely that the value of errorMode is set to DetailedLocalOnly, but this value doesn’t help for troubleshooting a WordPress site since IIS won’t consider your access local even if you access it from the machine running IIS.  Too bad really, since after you are done with your troubleshooting you will want to reset the value back to DetailedLocalOnly.


Comments Off on Troubleshooting on IIS7

Docking Windows in Visual Studio

Visual Studio Docking Guides I made a mistake today when trying to move tool windows around in Visual Studio – I merged the two docking frames at the bottom while debugging.  I couldn’t figure out how to split them again, so I decided to search for a solution.  MSDN came to the rescue :-)

When you drag a tab or a window, a guide diamond appears with four arrows and a center.  There are also four arrows at each side of the Visual Studio Window.  Each of these guides (a total of 9) allow you to create a new docking frame or add the dockable window to an existing frame.  For example, if you want to create a new frame on the right side, move the mouse to the arrow at the far right of the Visual Studio window while you are dragging the dockable window and you will see a blue are highlighted where it will place the window.

I’ve been seeing these guides for a long time but never tried hovering over one of them to see what they would do.  I have to say, they are a very nice interface.


Comments Off on Docking Windows in Visual Studio

PHP Failure Due To Missing Timezone

I’ve been working on installing PHP 5.3.0 on a new server running Windows Server 2008 R2 and encountered a problem I hadn’t run into before.  After installing PHP following the instructions I published here (FastCGI is supported natively by W2K8 R2 so I didn’t need to do anything to use that), the following message was displayed when I navigated to http://localhost/phpinfo.php:

[06-Nov-2009 11:53:17] PHP Warning: phpinfo(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/Los_Angeles’ for ‘-8.0/no DST’ instead in C:\inetpub\wwwroot\phpinfo.php on line 1

The solution is to do exactly what the error message says – set the date.timezone setting in the php.ini file.  This must be a new requirement of version 5.3.0 as I didn’t have to add this setting in previous versions.  Too bad the folks who added this requirement didn’t talk to the folks who maintain the installation program to add an addition page (or something) to set the time zone.  Oh well.  It works now :-)

Some notes.

  • You may need to stop and restart either the application pool or IIS itself to get it to recognize the change in the php.ini file.
  • If you misspell the time zone, you will get the same error.  I misspelled Los_Angeles as Los Angeles (space instead of underscore between the two words).
  • I’ve changed my article on installing PHP to reflect this newly discovered information.


Comments Off on PHP Failure Due To Missing Timezone

Page 2 of 1612345...10...Last »