Tag: tweaks

Associate Any File with Notepad in Five Seconds

Posted on June 21, 2009 in Technology by Jeff Starr

In my article, Associate Extensionless Files with Notepad, I explain how to navigate the labyrinthine maze of Windows dialogue menus to assign Microsoft’s Notepad text editor as the opening application for files without extensions. In this post, I’ll show you how to associate any file type with any program (including Notepad) in less than five seconds.

Ready? Don’t blink, you’ll miss it.. ;)

Modify any file extension association in five seconds

Open the Windows command prompt and enter the following command:

assoc .extension=fileType

It’s that easy. What is happening here? Let’s break it down, just for fun:

  • assoc — Windows file-association command
  • .extension — the extension of the file for which you would like to associate
  • fileType — the type of file that you would like to associate with your extension

Continue Reading

3 Ways to Exclude Content from WordPress Feeds

Posted on June 11, 2008 in WordPress by Jeff Starr

~{*}~ This may surprise you, but I post quite a bit of content that never appears in the site’s main feed. It is my impression that a vast majority of subscribers are interested in web/graphic-design and development-related topics, and are really much less interested (if at all) in the miscellaneous odds and ends that wind up in the ever-expanding Perishable Press database.

In the past, the process of excluding content from the main feed typically involved changing the post-date to something at least a year or so in the past. The thinking was that I could always return to these posts at some point in the future and put them back into sequential order. Although effective, this process quickly became far too tedious and time-consuming to prove practical. Keeping my eyes open for possible solutions, I have accumulated several excellent techniques for excluding content from WordPress feeds.

Continue Reading

WordPress Core Hacks Used at Perishable Press

Posted on December 3, 2007 in Perishable, WordPress by Jeff Starr

One of the necessary evils associated with creating a highly customized WordPress-powered site involves the inevitable necessity to hack the WordPress core. WordPress is built for mass-consumption and tends to cater to the largest audience possible, making it necessary to bend and poke around the corners to get WordPress to function in a more specific or specialized capacity.

Of course, there is a major downside to tweaking core WordPress files: upgrading. The overambitious WordPress peeps are constantly rolling out upgrade after upgrade, many of which are required security fixes, patches, or whatever. The point is that editing the WordPress core on your current version of WordPress requires that you edit each and every subsequent upgrade, for each and every one of your sites.

Over time, I have realized the importance of documenting core changes for any sites that require them. Having a concise record of the files and code involved with each hack greatly facilitates the entire upgrade process. Without such a reference, subtle changes may be forgotten and key hacks may be overlooked. Here at Perishable Press, my former Core Hacks Log served me well from WordPress 1.5 to 2.0, however, much of it no longer applies to the new WordPress 2.3 configuration. Since the latest site overhaul, I have dramatically reduced the overall number of required core edits.

Continue Reading

Stop WordPress from Leaking PageRank to Admin Pages

Posted on August 29, 2007 in Function, WordPress by Jeff Starr

During the most recent Perishable Press redesign, I noticed that several of my WordPress admin pages had been assigned significant levels of PageRank. Not good. After some investigation, I realized that my ancient robots.txt rules were insufficient in preventing Google from indexing various WordPress admin pages. Specifically, the following pages have been indexed and subsequently assigned PageRank:

  • WP Admin Login Page
  • WP Lost Password Page
  • WP Registration Page
  • WP Admin Dashboard

Needless to say, it is important to stop WordPress from leaking PageRank to admin pages. Instead of wasting our hard-earned link-equity on non-ranking pages, let’s redirect it to more important pages and posts. In order to accomplish this, we will attack the problem on three different fronts: admin links, robots.txt rules, and meta tags. Let’s take a look at each of these methods..

Continue Reading

Random Fixinz for Hotmail via Outlook Express

Posted on March 3, 2007 in Technology by Jeff Starr

Note: The methods described in this post apply to older versions of Internet Explorer (<6) and Outlook Express (<6), and are provided here for reference purposes only.

Fix the "Unable to poll for new messages" error

Here is an error message that some Outlook Express users receive when sending or receiving email, or after creating a new email account:

Unable to poll for new messages on your HTTP server. 
Account: 'Hotmail'
Server: 'http://services.msn.com/svcs/hotmail/httpmail.asp'
Protocol: HTTPMail
Server Response: 'End tag 'D:response' does not match the start tag 'D:prop'. 
Port: 0
Secure(SSL): No
Error Number: 0xC00CE56D

Continue Reading

Rename the Recycle Bin in WinXP

Posted on January 16, 2007 in Technology by Jeff Starr

To rename the Recycle Bin in Windows XP, create a new text.txt file in your favorite directory and add the following lines:

REGEDIT4
[HKEY_CLASSES_ROOT\CLSID\{645FF040-5081-101B-9F08-00AA002F954E}\ShellFolder]
"Attributes"=hex:50,01,00,20"CallForAttributes"=dword:00000000

Next, rename the file extension from ".txt" to ".reg" — the other part of the file name may be whatever you prefer (e.g., RecycleBin.reg). Then, double-click the file to have Windows import it into the Registry. Now go right-click your Recycle Bin and use the new option to Rename it.

To remove renaming functionality for the Recycle Bin, replicate the same file you created initially, and replace the last line (i.e., the third line) with the following:

"Attributes"=hex:40,01,00,20"CallForAttributes"=dword:00000000

Again, double-click the file to import it into the Registry.

Perishable Press Unresolved Error Log

Posted on January 15, 2007 in Perishable, Websites by Jeff Starr

This post is hereby dedicated to the official logging of all unresolved and/or unexplained errors encountered during development or implementation of various plugins, extensions, themes, scripts, and/or anything else that results in bizarre and mysterious errors, bugs, or other anomalies. Further, we will also post any potential solutions, fixes, workarounds, or explanations for any errors logged in this post. This information is provided for reference purposes only — please share any related information you may have concerning any of the errors described in this error log. Please use the comment form below or simply contact us directly. Thanks.

Continue Reading

Delete index.dat on Windows 98SE

Posted on January 8, 2007 in Technology by Jeff Starr

This brief tutorial on removing (and replacing) the "index.dat" file applies to any Windows OS running on MS-DOS. Although I haven’t researched this officially, it appears that all Windows versions released prior to Windows 2000 are running on the 16-bit MS-DOS kernel. Conversely, Win2000 and WinXP operate on a 32-bit kernel and thus do not utilize MS-DOS. Thus, this method focuses on removing the index.dat from machines running Windows 95, 98, and 98SE.

As you may be aware, Internet Explorer utilizes a file called "index.dat". The index.dat file serves a log that documents every domain visited through Internet Explorer. Deleting or modifying this file through Windows is impossible because Windows is "using" the file whenever Windows is running. Thus, to delete (or edit) the index.dat file, it is necessary to operate outside of Windows via MS-DOS mode.

So, without further ado, follow these easy steps to replace your unwanted index.dat file with a new, "empty" index.dat file:

  1. Click "Start > Shut Down > Restart in MS-DOS mode > OK"
  2. At the DOS prompt, enter: "del c:\windows\tempor~1\content.ie5\index.dat" (without the quotes)
  3. Press "Enter" and reboot the system. Windows will create a new index.dat file automatically.

Path to Outlook Express Files on WinXP

Posted on January 8, 2007 in Technology by Jeff Starr

Trying to backup your Outlook Express .dbx files on Windows XP may prove difficult if you can’t find them. Well, fret no more, my friend. Here is the generalized path to the Outlook Express folder, which contains all of the .dbx files for a particular user. Copy, paste, and shortcut:

C:\Documents and Settings\[username]\Local Settings\Application Data\Identities\{12345678-1234-ABCD-EFGH-1234567890AB}\Microsoft\Outlook Express

* [username] = each user will should have their set of .dbx files.
* {12345678-1234-ABCD-EFGH-1234567890AB} = represents a unique alphanumeric string.

WordPress on Crack: Tips for Faster Post Publishing

Posted on November 20, 2006 in Function, WordPress by Jeff Starr

Apparently, article posting is painfully slow on 2-ish versions of WordPress. Indeed, we finally got tired of waiting several minutes every time we published, saved, or edited a post.

After a bit of research, reading through countless complaints and suggested remedies, several key methods began to emerge. And, after taking the time to implement them, we have definitely enjoyed an substantial decrease in time required to publish, save, or edit posts.

Please note that everyone’s site is configured differently. These are the tricks that helped us to speed up publishing, but they may not have the same effect for everyone. The following methods were executed for this site, which is currently running WordPress 2.0.5 on Apache.

Delete rpc.pingomatic.com
Perhaps the most commonly recommended fix for slow posting: Remove "rpc.pingomatic.com" from the Admin » Options » Writing » Update Services panel. For some reason, pingomatic is really slow these days. Try using pingoat.comhttp://pingoat.com/goat/RPC2 ], ipings.com, or any variety of others 1 instead.
Delete all cached content
Another trick that helps improve posting speed is to delete the entire contents of the WordPress cache. It is entirely safe to delete everything in the wp-content/cache directory. In case you are paranoid, make a backup copy before doing so ;)
Remove the admin post preview panel
If you never use the "post-preview" window that appears near the end of your "Write Post" panel, go ahead and remove it. Doing so will save bandwidth, load time, processing time, etc. To eliminate such superfluousness, crack open your wp-admin/post.php file and delete precisely the following region of code (located near line #83 in WP 2.0.5), which may look slightly different in previous versions of WordPress:
<div id='preview' class='wrap'>
<h2 id="preview-post"><?php _e('Post Preview (updated when post is saved)'); ?> <small class="quickjump"><a href="#write-post"><?php _e('edit &uarr;'); ?></a></small></h2>
<iframe src="<?php echo wp_specialchars(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" width="100%" height="600" ></iframe>
</div>

References

Theme Edits for IE7

Posted on October 31, 2006 in Perishable, Websites by Jeff Starr

This post is a working repository of code edits and other changes made to Perishable Press themes in order for them to function properly in Internet Explorer 7 (IE7)..

Jupiter Theme
*:first-child+html div.comwrap {
	overflow: visible;
}
Lithium Theme
*:first-child+html div.comwrap {
	overflow: visible;
}
Casket Theme
Removed html selector from first ruleset.

Extreme Makeover for Gravatars in WordPress

Posted on October 30, 2006 in Websites, WordPress by Jeff Starr

Strategic Methods for Improving Gravatar Functionality in WordPress

Gravatars have become a popular way of adding spice to the "comments" page of many WordPress-powered sites. So popular, in fact, that the gravatar server is often overloaded, bogged down with millions of gravatar requests every second. This immense server load effects user pages everywhere, resulting in slow loading times, unresolved server requests, and missing gravatars. Such broken presentations appear unprofessional, tarnish reputations, and may provoke confusion. This article provides essential solutions for an extreme gravatar makeover..

Continue Reading

Delete Unwanted Context Menu Items in WinXP

Posted on October 16, 2006 in Technology by Jeff Starr

Within the right-click context menu is the option to create "New" file items. While the list of available documents within the "New" submenu often contains several useful file types, such as .txt or .zip, it also contains lots of unnecessary entries.

To clean up the "New" right-click context menu, open the Registry Editor, regedit.exe, and Find all instances of "ShellNew". Examine the search results. Every ShellNew branch belongs to a specific type of file. As each ShellNew branch corresponds to an entry in the "New" right-click context menu, delete the ShellNew branch for each "New" file type that you would like to remove. And that, as they say, is that.

Folder Background Images in WinXP

Posted on October 16, 2006 in Technology by Jeff Starr

This brief tutorial explains how to add a background image to any folder in Windows XP.

First, make sure all hidden files are visible on your system. Then, open the folder for which you wish to add a background image. Within the folder, right-click and select Properties » Customize tab » Customize. There, choose any icon, click Apply and OK.

That process should have created a "desktop.ini" file. Open that file with a text editor and add these lines of code:

[ExtShellFolderViews]
{BE098140-A513-11D0-A3A4-00C04FD706EC}={BE098140-A513-11D0-A3A4-00C04FD706EC}
[{BE098140-A513-11D0-A3A4-00C04FD706EC}]
IconArea_Image=C:\path\folder\background.jpg

To customize this according to your needs, edit the path in the last line to reflect to the location of the image you wish to use as the background image for that folder. Refresh the folder and the new background should appear.

Finally, to remove the default icon chosen during the creation of the desktop.ini and restore the default folder icon, delete these lines of code from within the desktop.ini file:

[.ShellClassInfo]
IconFile=%SystemRoot%\system32\shell32.dll
IconIndex=(some number)

Customize WordPress Quicktags

Posted on September 18, 2006 in Function, WordPress by Jeff Starr

Note: This condensed tutorial assumes you are working with WordPress 2+ and are familiar with editing .php and/or .js files.

WordPress quicktags1 provide shortcuts for adding certain bits of code to your posts. The default set of quicktags includes some handy shortcut buttons for tags such as <strong>, <a>, and <img>, as well as a few others. While the default set of quicktag buttons is occasionally useful, a quick bit of quicktag customization can easily transform your personal set of quicktag buttons into a deadly arsenal of time-saving code shortcuts.

First, open the quicktags.js file, usually located in the wp-includes/js directory. Next, scroll down to around line #40 and look for the following chunk of code:

edButtons[edButtons.length] = 
new edButton('ed_strong'
,'b'
,'<strong>'
,'</strong>'
,'b'
);

edButtons[edButtons.length] = 
new edButton('ed_em'
,'i'
,'<em>'
,'</em>'
,'i'
);

Now, to assist in the editing process, copy and paste this next bit of code in between any two of the edButtons[] statements. As this will be used as reference only, ensure that remains commented out:

/*

THIS IS THE GENERAL FORMAT OF A QUICKTAG BUTTON:

function edButton(id, display, tagStart, tagEnd, access, open) {
	this.id = id;             // used to name the toolbar button
	this.display = display;   // label on button
	this.tagStart = tagStart; // open tag
	this.tagEnd = tagEnd;     // close tag
	this.access = access;     // access key
	this.open = open;         // set to -1 if tag does not need to be closed
}

*/

With that in place, it is time to add a new button. Choose a code element that you find yourself frequently adding to your posts. Let’s say that you are always linking to a content directory called "content". In that case, let’s add a quicktag button that will automatically create a link to the content directory:

edButtons[edButtons.length] = new edButton('ed_content-link'
,'content-link'
,'<a href="http://yourblog.com/path/content/" title="">'
,'</a>'
,''
);

After saving and uploading the edited quicktags.js file, adding a link to your content directory is as easy as pressing the "content-link" quicktag button!

The process of adding other tags is essentially the same. Play around a bit and see what you come up with. Hopefully, this is enough information to get you started. Remember to delete the reference example after you have finished adding/editing buttons. For newer versions of WordPress, the same block of reference code is included near the top of the quicktags.js file itself. For more information on customizing quicktags, check out the tutorial2 listed in the reference section below.

References

Hacking Firefox Extensions

Posted on September 10, 2006 in Technology, Websites by Jeff Starr

Firefox extensions enable users to customize Firefox with additional features. Generally, Firefox extensions are free, open-source, and easily downloaded as .xpi files. This article explains how to hack Firefox extensions of the .xpi variety. There are many reasons why someone would want to hack a Firefox extension — examples include: editing code, debugging errors, and learning extensions. This hack method requires a web browser, zip utility, and text editor.

Step 1: Secure an extension

By default, the Firefox browser will cache and attempt to install any "extension.xpi" file it encounters. Once Firefox installs the plugin, it becomes much more complicated to hack. Therefore, it is best to save an offline copy of the extension. This is easily accomplished with a browser such as IE that does not automatically install the extension, but rather provides an option to save a copy. With IE, simply right-click the extension.xpi link and "Save Target As..". Regardless of the method, the point here is to secure a local copy of the extension.xpi file. Remember to make a backup copy.

Step 2: Initial extraction

Once you have a willing extension.xpi file, open it with a zip utility and extract the files into some directory, say, "/xpicontents/". Within the /xpicontents/ directory there should be at least a "chrome" folder, an "install.rdf" file, and a "licence.txt" file. Certain extensions may include additional and/or different files or folders. If anything looks too unfamiliar, extrapolate the method or find a different extension to use as you follow along.

Step 3: Editing the .rdf file

At this point, you have everything needed to edit the install.rdf file. Simply open the file in a text editor, make/save changes, zip the contents of /xpicontents/ into a new file, and change the file extension from .zip to .xpi. On the other hand, editing virtually any other aspect of the extension — JavaScript, CSS, (X)HTML — requires further digging.

Step 4: Hacking the .jar file

Located within the chrome folder, the "something.jar" file contains a variety of files, including JavaScript, CSS, (X)HTML, etc. Most extension editing will ultimately find its way to one of the files contained within the extension’s .jar file. So, to begin, rename the something.jar file to "something.jar.zip". Then, using a zip utility, open the something.jar.zip file and extract its contents into a unique directory, say, "/jarcontents/". Within the /jarcontents/ directory there should be at least two folders, "content" and "skin". Now, dive into the contents folder (or the skin folder, if needed) and edit, hack, and tweak the files to your heart’s content.

Step 5: Repacking the extension

After the necessary edits have been made, it is time to put humpty back together again. The first step is to replace the original contents of the something.jar.zip file with the freshly edited contents. To do this, select both content and skin folders (or whichever contains the edited material), right-click and add the selected folders to the something.jar.zip file located within the /jarcontents/ directory. Then, rename something.jar.zip back to something.jar.

At this point, you are ready to (re)package the chrome folder, install.rdf file, and license.txt file into a new .zip file, which we will call "hacked-extension.zip". To do this, simply select all three items and zip them into a new file named hacked-extension.zip. Finally, rename hacked-extension.zip to match exactly the name of the original extension, extension.xpi.

Step 6: Installation and testing

Once the necessary edits have been made, it is time to install the extension. Open Firefox, drag-and-drop the extension, and click OK to install. Restart Firefox, activate the extension, and check its functionality. Lather, rinse, repeat. It may be a good idea to test the hacked extension under a variety of different user conditions. Or not. Whatever. At this point, it’s entirely up to you. You may also want to save a copy of the original extension together with your hacked extension along with a few notes, just in case.

Well that’s it for now — thank you for your gracious attention. God bless.

References

WordPress Core File Edits at Perishable Press

Posted on August 15, 2006 in Perishable, WordPress by Jeff Starr

Update: After upgrading Perishable Press in 2007, many of the hacks listed on this page are no longer applicable. Please refer to our new WordPress Core Edits for current information. Otherwise, this article remains online for reference purposes only.

The folks developing WordPress are continually rolling out “upgrades”. While it is generally a good idea to stay current, it can also be a bit of a pain if you have made any changes to the WordPress core files. Our recommendation? Keep a log such as this one that either includes all edits or links to posts describing them. That way, when it is time to upgrade to WP 3.0.1, WP 3.0.2, … WP 9.0.1, WP 9.0.2 … (you get the idea), it will simply be a matter of referring to your handy WP core file change log and then going thru the list, copying & pasting your way back to complete functionality. Just remember to add any subsequent changes to the list, though, or you may find yourself scratching your head after the next upgrade. Another good idea involves carefully comparing any code you are replacing, checking to make sure the wizards at WordPress haven’t changed any aspects of the original code (of which you are replacing).

So, without further ado, here are the WordPress core file edits currently operating here at Perishable Press:

Customize the_excerpt function

File: wp-includes/functions-formatting.php (~ lines #763 & 767): set to desired values:

$excerpt_length = 50;
...
array_pop($words);
array_push($words, '[...] ( click post title to read more )');
$text = implode(' ', $words);

Customize the wpautop function

File: wp-includes/functions-formatting.php (~ line #72, #83):

$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n\t\t\t\t\t\t", $pee); // make paragraphs, including one at the end
$pee = str_replace("<p><!--", "<!--", $pee);
$pee = str_replace("--></p>", "-->", $pee);
return $pee;

Customize the more quicktag

File: wp-includes/template-functions-post.php (~ lines #54, 62, 92):

function the_content($more_link_text = 'Continued >>', $stripteaser = 0, $more_file = '') {
   $content = get_the_content($more_link_text, $stripteaser, $more_file);
   $content = apply_filters('the_content', $content);
   $content = str_replace(']]>', ']]&gt;', $content);
   echo $content;
}
...
function get_the_content($more_link_text = 'Continued >>', $stripteaser = 0, $more_file = '') {
   global $id, $post, $more, $single, $withcomments, $page, $pages, $multipage, $numpages;
   global $preview;
   global $pagenow;
   $output = '';
...
...
else
   //$output .= ' <a href="'. get_permalink() . "#more-$id\">$more_link_text</a>";
   $output .= ' <a href="'. get_permalink() . "\">$more_link_text</a>";
}

Customize Default Password Text

File: wp-includes/comment-functions.php (~ line #296):

Password Required

WordPress RDF Source Makeover

File: wp-includes/comment-functions.php (~ line #513):

function trackback_rdf($timezone = 0) {
	global $id;
	if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
	echo '<rdf:RDF ';
	echo "\n";
	echo '   xmlns:dc="http://purl.org/dc/elements/1.1/" ';
	echo "\n";
	echo '   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ';
	echo "\n";
	echo '   xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">';
	echo "\n";
	echo '<rdf:Description ';
	echo "\n";
	echo '   dc:creator="';
	the_author();
	echo '" '."\n";
	echo '   dc:date="';
	the_date_xml();
	echo ' @ ';
	the_time('g:i a');
	echo '" '."\n";
	echo '   dc:title="'.str_replace('--', '&#x2d;&#x2d;', wptexturize(strip_tags(get_the_title()))).'" '."\n";
	echo '   rdf:about="';
	the_permalink();
	echo '" '."\n";
	echo '   dc:identifier="';
	the_permalink();
	echo '" '."\n";
	echo '   trackback:ping="'.trackback_url(0);
	echo '" '."\n";
	echo '   dc:description="';
	the_excerpt_rss();
	echo '" />'."\n";
	echo '</rdf:RDF>';
	}
}

And then replace the_excerpt_rss(); with:

the_content_rss('', TRUE, '', 7, 2);

Title Attributes for WordPress Post Navigation

File: wp-includes/template-functions-links.php (~ lines #348, 369, 459, 494, 503):

$string = '<a href="'.get_permalink($post->ID).'" title="Go to previous post">'.$previous;
...
$string = '<a href="'.get_permalink($post->ID).'" title="Go to next post">'.$next;
...
...
function next_posts_link($label='Next Page &raquo;', $max_page=0) {
...
echo '" title="Go backward in time">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
...
function previous_posts_link($label='&laquo; Previous Page') {
...
echo '" title="Go forward in time">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
...
function posts_nav_link($sep=' &#8212; ', $prelabel='&laquo; Previous Page', $nxtlabel='Next Page &raquo;') {

Vars Tweak for htaccess Edits

File: wp-includes/vars.php (~ #35):

// Server detection
//the next line is used to allow WP to write htaccess rules during permalink creation (comment out the $is_apache line first)
//$is_apache = 1;
$is_apache = ( strstr($_SERVER['SERVER_SOFTWARE'], 'Apache') || strstr($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') ) ? 1 : 0;

Customize Password-Protected Posts

File: template-functions-post.php (~ line #3):

function get_the_password_form() {
	$output = '<form action="' . get_settings('siteurl') . '/wp-pass.php" method="post">
	<p>' . __("This post is password protected. To view it please enter your password below:") . '</p>
	<p><small><label class="h">' . __("Password: ") . ' </label><input class="postpassword" name="post_password" type="password" size="11" /> <input class="passwordsubmit" type="submit" name="Submit" value="' . __("Submit &raquo;") . '" /></small></p>
	</form>
	<div class="clear vspace">&nbsp;</div>
	';
	return $output;
}

Reversing WordPress Post Navigation Order

File: template-functions-links.php (~ lines #503, 518):

Note: It looks like this change has been implemented (as of WP 2.0.5)..

function posts_nav_link($sep=' &#8212; ', $prelabel='&laquo; Previous Page', $nxtlabel='Next Page &raquo;') {
...
if ( $max_num_pages > 1 ) {
	previous_posts_link($prelabel);
	echo preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $sep);
	next_posts_link($nxtlabel, $max_page);
}

Customize Quicktag Buttons

File: wp-includes/js/quicktags.js (~ line #37):

Required edit: delete the empty spaces out of the "pre code" button.

// CUSTOM QUICKTAGS BEGIN HERE

edButtons[edButtons.length] = new edButton('ed_authent'
,'authenticate'
,'<!--authenticate-->'
,''
,''
);

edButtons[edButtons.length] = new edButton('ed_quotes'
,'quotes'
,'&ldquo;'
,'&rdquo;'
,''
);

edButtons[edButtons.length] = new edButton('ed_dash'
,'dash'
,'&#8212;'
,''
,''
);

edButtons[edButtons.length] = new edButton('ed_rsquo'
,'rsquo'
,'&rsquo;'
,''
,''
);
edButtons[edButtons.length] = new edButton('ed_lsquo'
,'lsquo'
,'&lsquo;'
,''
,''
);

edButtons[edButtons.length] = new edButton('ed_acronym'
,'acronym'
,'<acronym title="">'
,'</acronym>'
,''
);

edButtons[edButtons.length] = new edButton('ed_clearspace'
,'clearspace'
,'<div class="clear vspace">&nbsp;</div>'
,''
,''
);
edButtons[edButtons.length] = new edButton('ed_follow'
,'follow link'
,'<a href="" title="">'
,'</a>'
,''
);
edButtons[edButtons.length] = new edButton('ed_nofollow'
,'nofollow link'
,'<a href="http://" title="" rel="nofollow">'
,'</a>'
,''
);
edButtons[edButtons.length] = new edButton('ed_press-link'
,'press link'
,'<a href="http://perishablepress.com/" title="Perishable Press">'
,'</a>'
,''
);
edButtons[edButtons.length] = new edButton('ed_reflist'
,'ref list'
,'<h3 class="references"></h3>\n\t<ul class="refs">\n\t<li><sup>1</sup> <a href="http://" title=""></a></li>\n\t<li><sup>2</sup> <a href="http://" title=""></a></li>\n'
,'</ul>'
,''
);
edButtons[edButtons.length] = new edButton('ed_content-link'
,'content-link'
,'<a href="http://perishablepress.com/press/wp-content/online/" title="Perishable Press">'
,'</a>'
,''
);
edButtons[edButtons.length] = new edButton('ed_press-image'
,'press image'
,'<img src="http://perishablepress.com/press/wp-content/images/" title="" alt="" />'
,''
,''
);
edButtons[edButtons.length] = new edButton('ed_pre-code'
,'pre code'
,'< pre>< code>'
,'< /code>< /pre>'
,''
);
edButtons[edButtons.length] = new edButton('ed_sup'
,'sup'
,'<sup>'
,'</sup>'
,''
);
edButtons[edButtons.length] = new edButton('ed_quot'
,'quot'
,'&quot;'
,''
,''
);
edButtons[edButtons.length] = new edButton('ed_<'
,'<'
,'&lt;'
,''
,''
);
edButtons[edButtons.length] = new edButton('ed_>'
,'>'
,'&gt;'
,''
,''
);

// CUSTOM QUICKTAGS END HERE

Remove the Admin Post-Preview Panel

File: wp-admin/post.php (line #83) & wp-admin/edit-form-advanced.php (line 17):

First, open wp-admin/post.php and delete these lines:

<div id='preview' class='wrap'>
<h2 id="preview-post"><?php _e('Post Preview (updated when post is saved)'); ?> <small class="quickjump"><a href="#write-post"><?php _e('edit &uarr;'); ?></a></small></h2>
<iframe src="<?php echo wp_specialchars(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" width="100%" height="600" ></iframe>
</div>

Then, open wp-admin/edit-form-advanced.php and delete these lines:

<?php if ( 0 != $post_ID ) : ?>
 <small class="quickjump"><a href="#preview-post"><?php _e('preview &darr;'); ?></a></small>
<?php endif; ?>

Enhance parse_url Functionality

File: wp-includes/functions.php (~ lines #1067): insert "@" before parse_url and praise the Lord!

Remove CSS Link to Print Stylesheet

File: press/wp-subscription-manager.php (~ line #100): delete the following line to eliminate unnecessary 404 errors when users subscribe/unsubscribe to comments (or when managing subscriptions):

<link rel="stylesheet" type="text/css" media="print" href="<?php echo get_settings('siteurl'); ?>/print.css" />

Customize Comment Feed Link

File: wp-includes/feed-functions.php (line #84): edit according to current default theme requirements:

echo "<a href='$url'>$link_text</a>";

--- changed to --->

echo "<a class=\"feed-icon\" href='$url' title=\"Subscribe to comments for this article\" rel=\"nofollow\">$link_text</a>";

Customize Commentator Links

File: wp-includes/comment-functions.php (~lines #358-368): swap the following:

/* original */
function get_comment_author_link() {
	global $comment;
	$url    = get_comment_author_url();
	$author = get_comment_author();

	if ( empty( $url ) || 'http://' == $url )
		$return = $author;
	else
		$return = "<a href='$url' rel='external nofollow'>$author</a>";
	return apply_filters('get_comment_author_link', $return);
}
// core file edit listed at perishablepress.com
// http://perishablepress.com/press/2006/08/15/wordpress-core-file-edits/
function get_comment_author_link() {
	global $comment;
	$url    = get_comment_author_url();
	$author = get_comment_author();

	if($comment->comment_type == 'pingback' || $comment->comment_type == 'trackback' ) { 
				if ( empty( $url ) || 'http://' == $url ) {
					$return = $author;
				} else {
					$return = '<a href="'.$url.'" rel="external">'.$author.'</a>';
				}
	} else {
				if ( empty( $url ) || 'http://' == $url ) {
					$return = $author;
				} elseif ( $author == 'blacklist' ) {
					$return = '<a href="'.$url.'" rel="external nofollow">'.$author.'</a>';
				} else {
					$return = '<a href="'.$url.'" rel="external">'.$author.'</a>';
				}
	}
	return apply_filters('get_comment_author_link', $return);
}

References

Associate Extensionless Files with Notepad in WinXP

Posted on August 8, 2006 in Technology by Jeff Starr

There are several files that appear not to have extensions in Windows XP. Perhaps the best known example is the HOSTS file. Files such as the HOSTS file that appear to be "extensionless" actually contain an invisible period "." — or dot — at the end the file name. It is this invisible dot that will enable us to select a specific program with which to open files with no extensions.

As web developers, we are constantly checking and consulting server-generated error_log files. Like the HOSTS file, the error_log files appear to have no associated extension. In Windows XP, opening extensionless files requires opening the "Open with…" dialogue box and scrolling through a long list of file types. And, although there is a checkbox option within the dialogue box enabling users to "Always use the selected program to open this kind of file," the option is "greyed out" and useless. Thus opening an extensionless file requires four or five extra "clicks", as well as the extra time it takes to jump through the hoops. This may not sound like a big deal, but try opening any number of files by this method and the extra clicks begin to add up.

After opening our millionth error_log file using the "Open with" method, we decided to confront the problem and devise a solution. After a bit of research, we were presented with several options: editing the registry, installing software, or tweaking Windows "Folder Options". After fiddling with the registry and installing some software with no real progress, we decided to try the heretofore unsuccessful "Folder Options" method. Sure enough, armed with an invisible dot and a slight tweak, we were finally able to convince Windows XP to associate extensionless file types with Notepad, our program of choice for such files.

The Solution

Although this solution is relatively risk-free 1, requiring no registry editing or software installation, the process is fairly sensitive, requiring careful attention. Below are two methods: the first associates extensionless files with Notepad, while the second does such with WordPad. Both assume a Windows XP operating system.

Here is the method of associating extensionless file types with Notepad in WinXP:

  1. Open Windows Explorer and go to the "Tools › Folder Options › File Types" menu.
  2. Click the "New" button and type ".txt" in the "File Extension" field.
  3. Click on the "Advanced ››" button and the "Associated File Type" should read "Text Document". If it is blank, or says something else, close everything out and start over, making sure to follow the steps in order.
  4. Finally, in the "File Extension" field, replace the ".txt" with a single dot, "."
  5. Click "OK" and exit. Find or create an extensionless file and check it out.

Here is a similar method of associating extensionless file types with WordPad in WinXp:

  1. Open Windows Explorer and go to the "Tools › Folder Options › File Types" menu.
  2. Click the "New" button and type ".txt" in the "File Extension" field.
  3. Click on the "Advanced ››" button and the "Associated File Type" should read "Text Document". If it is blank, or says something else, close everything out and start over, making sure to follow the steps in order.
  4. Open the "Associated File Type" dropdown menu. Scroll down and select "Wordpad Document".
  5. Finally, in the "File Extension" field, replace the ".txt" with a single dot, "."
  6. Click "OK" and exit. Find or create an extensionless file and check it out.

Footnotes

  • 1 It is always a good idea to backup your registry and other critical documents before implementing any system changes.

Lightbox + FancyTooltips Bug Fix

Posted on July 25, 2006 in Function, WordPress by Jeff Starr

For those of us enjoying the stylish functionality of Lightbox or any of its many incarnations, images "magically" overlay the window and unfold, revealing navigational buttons, image count, and of course the image titles.

For those of us enjoying the stylish functionality of FancyTooltips or any of its many incarnations, title and alt attributes manifest as stylish displays of CSS brilliance.

However, for those of us employing both features, there is a potential JavaScript conflict. This conflict makes it impossible for Lightbox to display the contents of title attributes associated with images. Thus, if you are employing Lightbox (or one of its many variations) and FancyTooltips (or one of its many variations), image titles will be missing from your Lightbox-displayed images. If this is the case, everything else (nav buttons, number display, close button) will display properly, including the "fancy" tooltips. If this sounds like your situation — missing Lightbox titles — we have good news..

Fortunately, the "fix" for this "bug" is relatively simple. Before getting to that, it is important to explain two things: (1) cause of the conflict and (2) verification of the conflict. Keep in mind that we are attempting to extrapolate from several specific scenarios to many possible configurations. So, if this article fails to fix your specific setup, hopefully it will provide insight toward an individually deduced solution.

First, let's examine the cause of the conflict. Generally speaking, JavaScript-based tooltip enhancement involves replacing title and/or alt attributes with author-specified "hooks" that enable scripts to function. For example, the FancyTooltips script rewrites all title="" attributes as fancytooltip="", thereby enabling the FancyTooltips script to recognize and act upon such attributes exclusively.

The problem is that once all of the title="" attributes have been replaced with script-specific hooks, Lightbox no longer recognizes them, making it impossible to display their contents. Hence the mysteriously missing Lightbox titles. To verify this, use your browser's "Save Page As…" feature to save an offline copy1 of a page that uses both Lightbox and FancyTooltips (or any other similarly conflicting scripts). Then, examine the source code of the offline copy and look for title="" attributes replaced by fancytooltip="". If you find that the title and/or alt attributes have indeed been rewritten, read on for the fix!

The Fix

Now that you hopefully understand the nature of the dilemma, it is time to completely eliminate the conflict.

Open your lightbox.js file and scroll down to around line #333, searching for the following:

// if image is NOT part of a set..
if((imageLink.getAttribute('rel') == 'lightbox')){
	// add single image to imageArray
	imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));			
} else {
// if image is part of a set..
	// loop through anchors, find other images in set, and add them to imageArray
	for (var i=0; i<anchors.length; i++){
		var anchor = anchors[i];
		if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))){
			imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
		}
	}
	imageArray.removeDuplicates();
	while(imageArray[imageNum][0] != imageLink.getAttribute('href')) { imageNum++;}
}

Now, near the end of the fourth line, replace title with fancytooltip. Then, likewise, near the end of the eleventh line, replace title with fancytooltip. You're done. Upload the file and check tooltips and Lightbox images. You should now be enjoying titles in your image popups and titles in your fancy tooltips. Note that this easy fix may be generalized to any set of similarly conflicting scripts. Simply determine the rewritten attributes by saving an offline copy and then search for & replace the offending values in the corresponding scripts.

This article is a work in progress. Please contribute any helpful information by leaving a comment below or via the Contact form. God Bless.

Footnotes

  • 1 In general, offline copies are very useful troubleshooting tools, as they represent the code after scripts have acted upon it, thereby offering a more accurate view of what the browser actually interprets.

Passing Quotation Marks via wp_link_pages

Posted on June 12, 2006 in Function, WordPress by Jeff Starr

According to the WordPress Codex 1, it is possible to pass quotation marks via the parameters of the function, wp_link_pages(). This would enable users to assign a particular css class or id to the function output, thereby providing greater design and behavioral control over that particular object.

But alas, as reported several times in the WordPress Codex 2, wp_link_pages() is unable to pass quotes without causing errors.

To fix this, we open template-functions-post.php and find wp_link_pages(), which is located around line #121 (for WP 2.0.2).

The fix is easy, simply edit the <p> in the following lines:

$r['before'] = '<p>' . __('Pages:');
$r['after'] = '</p>';

For example, if you wanted to wrap the function output with a <div class="foo"> and subsequent </div>:

$r['before'] = '<div class="foo">' . __('Pages:');
$r['after'] = '</div>';

Upload and done. Do not forget to eliminate the before= and after= parameters when calling the function from the loop 3.

References

Reversing WordPress Page Navigation Order

Posted on June 7, 2006 in Function, WordPress by Jeff Starr

This article explains how to reverse the order of WordPress page navigation links.

To reverse the default (backward) order of page navigation in WordPress, open the file template-functions-links.php (in WP 2.0) or link-template.php (in WP 2.1/2.2) and scroll down to the last function, posts_nav_link() 1. Next, find the last if statement and switch the order of the following two lines:

previous_posts_link($prelabel);
   [ ignore this line ]
next_posts_link($nxtlabel, $max_page);

Next, within the first line of the same function (beginning with function posts_nav_link), switch the order of the variables $prelabel='&laquo; Previous Page' and $nxtlabel='Next Page &raquo;'.

Finally, within the loop, make sure you are calling the function with the usual parameters in place. Something like:

<?php posts_nav_link(' | ','&laquo; Previous Entries','Next Entries &raquo;') ?>

That’s it! Your post navigation links (for index and category views) should now operate according to the following principle: left links point to older posts and right links post to newer posts.

References

  • 1 Not to be confused with previous_post_link() and next_post_link(), which provide navigational links to older individual posts and newer individual posts, respectively. Oddly enough, in the case of post-by-post navigation, WordPress gets it right: left links point to older posts and right links post to newer posts; however, this is not the case with page-by-page navigation, in which WordPress adopts the reverse strategy.

Gizoogle Gonna Break it Down

Posted on May 16, 2006 in Nonsense by Jeff Starr

Gangsta lean. Gangsta tuff. Da Gizoogle Search Engine & Translator delivahz da roofless bidniss fo' da previous post:


Osseus Returns Yo
Osseus Website Yo
Multimedia artist extraordizzle Kenneth Paul Schrag — betta known as Osseus ta his fellow DLa posse — is currently in tha process of updat'n his personal design portfolio website (Flash required) aww nah. Ken's aww nah. work is diverse, wit online samples cover'n both graphic design n illustration.

We finally met up wit Ken n Yasuko several months ago before they Japanese tizzle. They call me tha black folks president. We shared coffee in tha Desert Oasis n shared recent experiences n creative happen'n where the sun be shinin' and I be rhymin'. Ken n Yasuko hizzy bizzy busy work'n as Graphic Designa in tha Seattle area, n have big plans ta start a potentially lucrative design-based service business so bow down to the bow wow. Beyond this, they have worked several interest'n freelance jobs rang'n from model'n & sculpture ta illustration & design.

In related news, tha possible releaze of DLa #20 — The Elusive Texture Issue — has resurfizzles wit potential ta catalyze tha swift develizzle n re-establizzle of tha Dead Wanna Be Gangsta Art empire fo' sheezy. Website plans is in tha works, n several DLa-related graphic-dizzles projects hizzy been discussed with the gangsta shit that keeps ya hangin'. Especially rhymin' is ideas involv'n rappa press n archaic doggy stylin' methods. Stay tuned..


Sweet. But as if that weren’t dope enuf, repeated Gizoogle translations seem to increasingly multiply da def shizzle. Check it out cold gangsta: retranslate this translation and compare the results. Strictly fo' my nizzle…

Use this link to translate any page via Gizoogle »

Or, sizzle dizzle:
(limited number of lookups per day)

 

Title Attributes for WordPress Post Navigation

Posted on April 23, 2006 in Accessibility, WordPress by Jeff Starr

Improve accessibility by adding title attributes to your WordPress userspace.

Note: This article applies specifically to WordPress 2.0.2, but may be generalized to any WP 2.0+ version.

By default, WordPress navigation links omit the title attributes for both page and post views. Title attributes for links provide additional information that can improve the accessibility of your website. This is especially true when images or text symbols exclusively are used for navigation.

To add title attributes to WordPress page-view links (e.g., links for index, archive, and category views), open the file wp-includes/template-functions-links.php and find the functions previous_posts_link (line #494) and next_posts_link (line #459).

Within each function, replace the following line:

echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';

..with this:

echo '" title="EDIT THIS">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';

Next, replace the EDIT THIS text in each function with “Previous Posts” and “Next Posts”. Keep in mind the reverse chronological order by which these links navigate. Remember to check a few page views and then you are done.

Now, to add the title attribute to navigation links within individual post views. Open the same file as above, wp-includes/template-functions-links.php and find the functions previous_post (line #336) and next_post (line #357).

Within each function, replace the following line:

$string = '<a href="'.get_permalink($post->ID).'">'.$next;

..with this:

$string = '<a href="'.get_permalink($post->ID).'" title="EDIT THIS">'.$next;

Next, replace the EDIT THIS text in each function with “Previous Post” and “Next Post” respectively. Remember to check a few post views and then you are done.

WordPress RDF Source Makeover

Posted on February 22, 2006 in Websites, WordPress by Jeff Starr

Beautiful Source-Code Output, Part 1: Whip your WordPress RDF Code into Submission

Update: This article applies specifically to WordPress 2.0.2, but may be generalized to any WP 2.0+ version.

I love looking at beautiful source-code output. However WordPress tends to spit code out in random chunks, often leaving spaces, line breaks, and tabs littered throughout the source output. This messes things up. Lists don’t look like lists and logically written code often appears scattered along the page carelessly. Often, this is the result of poorly written PHP, which can be manipulated to write beautifully aligned code that looks as good as it works.

For the first article in this series, we will bring order to the typical RDF chaos that WordPress spits out by default. To see an example of this, check out this source code, taken directly from the output of a default installation of WordPress. Notice how the awkward chunk of code leans, strangely enough, to the right. This type of RDF-code output seems to be the norm for WordPress users who have enabled that particular feature.

Okay, so it looks hideous, and we want to clean it up and make it shine. First thing to do is backup everything, even your database. Don’t trip though — this is a simple “cut-and-paste” procedure, but it is always a good idea to have a recent backup of your data just in case. Next, open the file wp-includes/comment-functions.php and find the function trackback_rdf, which is located about halfway down the page on line #525 (#509 for WP 2.0). Now, replace the following block of PHP code:

function trackback_rdf($timezone = 0) {
	global $id;
	if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
	echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
	    xmlns:dc="http://purl.org/dc/elements/1.1/"
	    xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
		<rdf:Description rdf:about="';
	the_permalink();
	echo '"'."\n";
	echo '    dc:identifier="';
	the_permalink();
	echo '"'."\n";
	echo '    dc:title="'.str_replace('--', '&#x2d;&#x2d;', wptexturize(strip_tags(get_the_title()))).'"'."\n";
	echo '    trackback:ping="'.trackback_url(0).'"'." />\n";
	echo '</rdf:RDF>';
	}
}

with our new and improved version1:

function trackback_rdf($timezone = 0) {
	global $id;
	if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
	echo '<rdf:RDF ';
	echo "\n";
	echo '   xmlns:dc="http://purl.org/dc/elements/1.1/" ';
	echo "\n";
	echo '   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" ';
	echo "\n";
	echo '   xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">';
	echo "\n";
	echo '<rdf:Description ';
	echo "\n";
	echo '   dc:creator="';
	the_author();
	echo '" '."\n";
	echo '   dc:date="';
	the_date_xml();
	echo ' @ ';
	the_time('g:i a');
	echo '" '."\n";
	echo '   dc:title="'.str_replace('--', '&#x2d;&#x2d;', wptexturize(strip_tags(get_the_title()))).'" '."\n";
	echo '   rdf:about="';
	the_permalink();
	echo '" '."\n";
	echo '   dc:identifier="';
	the_permalink();
	echo '" '."\n";
	echo '   trackback:ping="'.trackback_url(0);
	echo '" '."\n";
	echo '   dc:description="';
	the_excerpt_rss();
	echo '" />'."\n";
	echo '</rdf:RDF>';
	}
}

Finally, open your WordPress theme’s “index.php” file, find the loop, and add an echoed line break to the commented-out RDF function. Your code should now look like this:

<!--
<?php trackback_rdf(); ?>
<?php echo "\n"; ?>
-->

That’s it — save the two files, upload them, refresh your pages, and check the RDF output in the source code. If all goes well, your RDF code should now resemble this:

<!--
<rdf:RDF 
   xmlns:dc="http://purl.org/dc/elements/1.1/" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<rdf:Description 
   dc:creator="Perishable" 
   dc:date="2006-02-22 @ 11:19 am" 
   dc:title="WordPress RDF Source Makeover" 
   rdf:about="http://perishablepress.com/press/?p=49" 
   dc:identifier="http://perishablepress.com/press/?p=49" 
   trackback:ping="http://perishablepress.com/press/wp-trackback.php?p=49" 
   dc:description="Beautiful Source-Code Output, Part 1: Whip your WordPress RDF Code into Submission
I love looking at beautiful source-code output. [...continued &#187;]" />
</rdf:RDF>
-->

Now that’s much better!

Next time we will look at constructing righteous headings and pimping them for excellence on planet source-code output.

Update: To gain greater control over your WordPress RDF source-code output, replace the native function, the_excerpt_rss(); (located near the last line of the trackback_rdf() function), with the more flexible function, the_content_rss. This function provides five parameters as described in the WordPress Codex:

<?php the_content_rss('more_link_text', strip_teaser, 'more_file', cut, encode_html); ?>

More specifically, here is how we use the function to limit the number of words output in the dc:description attribute, thus optimizing bandwidth while preventing unruly code examples from disrupting document structure (as in the case of JavaScript comments):

the_content_rss('', TRUE, '', 7, 2);

Fin

References