Skip to content

Google Browser Size Overlay div png

01-Mar-10

Google Browser Size is a valuable tool but sometimes you'd only need the overlay image (say, when your site is not publicly available). Overlay PNG is available at http://browsersize.googlelabs.com/static/2009-11-18-day_google_com_100.png.

Disable Quotation Mark Modifications from WordPress

10-Feb-10

Remove automatic modification of quotation marks (e.g. " to opening and closing quotation marks) by entering the following 4 lines to the functions.php file of your theme.

remove_filter('the_content', 'wptexturize');
remove_filter('the_title', 'wptexturize');
remove_filter('the_excerpt', 'wptexturize');
remove_filter('comment_text', 'wptexturize');

As the code says, it removes the wptexturize filter, which does other things as well, e.g. changes double dashes (--) to — characters, so unfortunately you'll lose those features too.

301 Redirect [PHP]

03-Feb-10

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.example.com/new-url/");

Done. PHP 301 redirect is now rolling in given directory once you put that, say, in a file named index.php.

JavaScript to Footer in WordPress

20-Jan-10

Want to move that jQuery and other js references from header to footer? Try JavaScript to Footer plugin.

Cookie-free JS, CSS, etc for WordPress

15-Jan-10

These 3 steps will help you to set up cookie free JavaScript, CSS and other files for your WordPress installation. (This is especially helpful for changing the domain of certain JS/CSS file references added by plugins.)

Before you start, make sure your blog URL has a leading www (e.g. www.example.com, not example.com). (Cookie-tech-stuff)

Step 1) Create a sub-domain pointing to your real web root (e.g. static.example.com).

Step 2a) Install CDN Rewrites plugin. (Did not work for me, so I had to revert to another way). If this is you as well, enter step 2b.1.

Step 2b.1) Install Free CDN plugin. Change its settings if you want to.

Step 2b.2) Edit /wp-content/plugins/free-cdn/free-cdn.php.

Find

if (isset($parts['port']))
{
$parts['host'] .= '.$parts[port].nyud.net';
unset($parts['port']);
}
else
{
$parts['host'] .= '.nyud.net';
}

around line 282. Right after this add:

$parts['host'] = 'static.example.com'; // my own edit

and make sure the domain matches the one you set up in step 1.

If you want to keep your edit safe, change the version number of the plugin to something like "1200" (at the beginning of the file) so that WP won't suggest updating the plugin.

[UPDATE: Remember to set WP cookie domain in wp-config.php: define('COOKIE_DOMAIN', 'www.yoursite.com');]