Articles tagged with “tricks”
- Toggle Element Visibility via JavaScript
- Recently, while restoring the popular Jupiter! WordPress theme, which several readers use to “skin” the Perishable Press website, I found myself searching for a simple, effective JavaScript technique for toggling element visibility. Specifically, I needed to accomplish the following design goals:
Users should be able to toggle the visibility of any division containing post-meta information
The post-meta information should remain visible by default and ...
- Blacklist Candidate Number 2008-04-27
- Welcome to the Perishable Press “Blacklist Candidate” series. In this post, we continue our new tradition of exposing, humiliating and banishing spammers, crackers and other worthless scumbags..
Since the implementation of my 2G Blacklist, I have enjoyed ...
- How to Block Proxy Servers via htaccess
- Not too long ago, a reader going by the name of bjarbj78 asked about how to block proxy servers from accessing her website. Apparently, bjarbj78 had taken the time to compile a proxy blacklist of over 9,000 domains, only to discover afterwards that the formulated htaccess blacklisting strategy didn’t work as expected:
deny from proxydomain.com proxydomain2.com
Blacklisting proxy servers by blocking individual domains seems like a futile exercise. Although there are ...
- Drop-Dead Easy Random Images via PHP
- Recently, while restoring my collection of Perishable Press themes, I needed a fast, effective way to randomize a series of images. After playing around with several likely candidates, I finally devised the following drop-dead easy technique:...
- Pure CSS: Better Image Preloading without JavaScript
- After reading my previous article on preloading images without JavaScript 1, Nanda pointed out that adding extra markup to preload images is not the best approach, especially where Web Standards are concerned. Mobile devices, for example, may experience problems when dealing with the following preloading technique:
/* ADD THIS TO CSS */
div#preloaded-images {
position: absolute;
overflow: hidden;
...
- How to Edit the Firefox Custom Dictionary
- Oooops! Didn’t really mean to add that particular word to the Firefox custom dictionary. Better remove it now before it causes problems later on..
As one who takes full advantage of the custom dictionary in Firefox, I occasionally find myself adding nonexistent or misspelled words to the dictionary by accident. Not wanting to deal with a false negative down the road, I always take the time to stop what I’m doing, locate the custom dictionary, and remove the ...
- WordPress Tip: Remove Spam from the Comment Subscription Manager
- After investigating some unusual 404 errors the other day, I found myself digging through the WordPress Admin trying to locate the “Subscribe to Comments” options panel. As it turns out, administrative options for the Subscribe to Comments plugin are split into two different areas. First, the ...
- Blacklist Candidate Number 2008-03-09
- Welcome to the Perishable Press “Blacklist Candidate” series. In this post, we continue our new tradition of exposing, humiliating and banishing spammers, crackers and other worthless scumbags..
Imagine, if you will, an overly caffeinated Bob Barker, hunched over his favorite laptop, feverishly scanning his server access files. Like some underpaid ...
- Unobtrusive JavaScript Dynamic Clock
- In this tutorial, I present an easy way to add a little extra flair to your site by adding some dynamic clock functionality. Using unobtrusive JavaScript, a bit of (X)HTML markup, and a dash of PHP (optional), we will create a dynamic clock that degrades gracefully to a static date/time-stamp when JavaScript is unavailable. No need to get all verbose with this one, ...
- 2G Blacklist: Closing the Door on Malicious Attacks
- Since posting the Ultimate htaccess Blacklist and then the Ultimate htaccess Blacklist 2, I find myself dealing with a new breed of malicious attacks. It is no longer useful to simply block nefarious user agents because they are frequently faked. Likewise, ...
- WordPress Discussion Management: Enable or Disable Comments and Pingbacks via SQL
- Continuing my quest to stop comment spam without using plugins, I have decided to disable comments on “old” posts. In my experience, over 90% of comment, trackback and pingback spam occurs on posts that have been online for over a ...
- Quickly Disable or Enable All WordPress Plugins via the Database
- Recently, while dealing with the dreaded white screen of death, I found myself unable to login to the WordPress Admin area to manually disable all of the plugins used here at Perishable Press. In the past, I have dealt with this situation by simply deleting all plugin files from the server, however this time, time was of the essence — I had only a few minutes with which to troubleshoot, diagnose, ...
- Error-Free Feed-Validation Links for Feedburner-Redirected Feeds
- Just a quick tip on how to create error-free links to feed validation services for feeds that are redirected through Feedburner. For example, let’s say our site’s main feed is originally located at:
http://domain.tld/feed/
If we wanted to provide our visitors with a link that would enable them to automatically validate our feed using a free service such as feedvalidator.org 1, we would create the link as follows:
Validate our Feed
..which would do the ...
- Transfer Autometa Plugin Data into All in One SEO Pack
- During my last redesign and site overhaul, I finally made the leap from WP 2.0 to 2.3. In the process of synchronizing data and removing unecessary plugins, I managed to replace several keyword- and meta-related ...
- Blacklist Candidate Number 2008-02-10
- Welcome to the Perishable Press “Blacklist Candidate” series. In this post, we continue our new tradition of exposing, humiliating and banishing spammers, crackers and other worthless scumbags..
Scumbag number 2008-02-10, “COME ON DOWN!!” — you’re the next baboon to get banished from the site! Like many bloggers, I ...
- Blacklist Candidate Number 2008-01-02
- Come one, come all — today we officially begin a new series of posts here at Perishable Press: the public exposure, humiliation, and banishment of spammers, crackers, and other site attackers. Kicking things off for 2008: blacklist candidate number 2008-01-02!
Every Wednesday, I take a little time to investigate my ...
- WordPress Tip: Reduce the Size of the WP-ShortStat Database Table
- In this article, I present a simple method for dramatically decreasing the size of your WordPress database by partially emptying old data from the WP-ShortStat table via the following SQL command:
DELETE FROM `wp_ss_stats` ORDER BY `id` ASC LIMIT n
That is the point of this entire article, which dips into just about everything one might need to know before employing such strategy. If you are familiar with SQL and understand the ...
- How to Enable PHP Error Logging via htaccess
- In this brief tutorial, I will show Apache users how to suppress PHP errors from visitors and enable PHP error logging via htaccess.
Tracking your site’s PHP errors is an excellent way to manage and troubleshoot unexpected issues related to plugins and themes. Even better, monitoring PHP errors behind the scenes ...
- Focus on the Details: Optimizing Images for Humans and Machines
- In this article, I discuss how to get the most out of your site’s images by optimizing them for both people and search engines..
For many sites, images play an important role in the communication process. If used correctly, images have the power to make your articles come alive with clarity and vibrancy. Some visitors may merely notice the image and continue reading, while others will want to ...
- Quick JavaScript Tip: Auto-Highlight Form Inputs and Textareas
- I realize that probably everybody already knows this elementary and absolutely dead-simple JavaScript tip, but I was surfing around the other day and encountered a page that made great use of some auto-highlighted textarea content. The idea is simple, include a snippet of JavaScript to enable users to automatically highlight/select upon focus any chunk of text located within a form input or textarea element. I would imagine this trick works with just about any element — buttons, ...
- 5 Easy Ways to Display Syntax Highlighted PHP Code
- A great to way to share your PHP code with visitors is to display it directly in the browser with automatically generated syntax highlighting. Here is a screenshot showing an example of syntax-highlighted PHP code:
Displaying your ...
- Three Ways to Allow Hotlinking in Specific Directories
- After implementing any of the hotlink-prevention techniques described in our previous article, you may find it necessary to disable hotlink-protection for a specific directory. By default, htaccess rules apply to the directory in which it is located, as well as all subdirectories contained therein. There are (at least) three ways to enable selective hotlinking:
Place hotlink images in an alternate directory
This method ...
- Stupid htaccess Trick: Enable File or Directory Access to Your Password-Protected Site
- In this brief tutorial, we are going to enable users to access any file or directory of a site that is password-protected via htaccess. There are many reasons for wanting to employ this technique, including:
Share public resources from an otherwise private site
Enable visitors to access content during site maintenance
Testing and formatting of layout and design during development
As a webmaster, I have used this technique on several ...
- Easily Adaptable WordPress Loop Templates
- In this article, I present several heavily commented examples of WordPress loops. I have found that many readers appreciate these types of loop examples, as it helps them to understand how the loop works while enabling them to easily copy, paste, and adapt the code for their own purposes. In our first example, we examine a basic WordPress ...
- Prevent JavaScript Elements from Breaking Page Layout when Following Yahoo Performance Tip #6: Place Scripts at the Bottom
- By now, everyone is familiar with the Yahoo Developer Network’s 14 “best-practices” for speeding up your website. Certainly, many (if not all) of these performance optimization tips are ideal for high-traffic sites such as Yahoo or Google, but not all of them are recommended for smaller sites such as Perishable Press. Nonetheless, throughout the ...
- Ultimate htaccess Blacklist 2 (Compressed Version)
- [ Keywords: htaccess, rewrite, blacklist, block, deny, spam, spammers, scrapers, rippers ]
In our original htaccess blacklist article, we provide an extensive list of bad user agents. This so-called “Ultimate htaccess Blacklist” works great at blocking many different online villains: spammers, scammers, scrapers, scrappers, rippers, leechers — you name it. Yet, despite its usefulness, there is always room for improvement. For example, as reader ...
- Fixing Mint after Switching Servers
- After switching Perishable Press to its current home at A Small Orange, I began noticing an unusual problem with referrer data displayed in Mint. Specifically, the first item recorded in the XXX Strong Mint data panel — for both “Most Recent” and “Repeat” views — displayed several thousand hits for various site resources, all from ...
- htaccess Combo Pack: WordPress Permalinks and non-www Redirect
- WordPress users employing permalinks via htaccess to optimize their dynamic URLs transform complicated-looking links such as:
http://example.com/blog/index.php?page=33
..into search-engine friendly links such as:
http://example.com/blog/post-title/
Every rewritten URL relies on a common set of htaccess rules to transform the links. The htaccess rules for all WordPress permalinks look like this for root WP installations:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond ...
- Absolute Horizontal and Vertical Centering via CSS
- Recently, a reader named Max encountered some scrolling issues while implementing our absolutely centered layout technique. Of course, by “absolutely centered” we are referring to content that remains positioned dead-center regardless of how the browser is resized. After noticing the scrollbar deficiency, Max kindly dropped a comment to explain the issue:
[...] the div solution works well, only one problem maybe somebody can help:...
- Super Loop: Exclude Specific Categories and Display any Number of Posts
- [ Keywords: wordpress, loop, have_posts, category, categories, post, posts, asides, excerpts ]
Readers occasionally ask for help with their WordPress loops. Usually, these requests involve modifying the loop with some customized functionality. Frequently, such customization involves one of these popular behaviors:
Exclude a specific category
Exclude multiple categories
Display only one post or excerpt
Display some fixed number of ...
- MySQL Magic: Find and Replace Data
- Recently, I needed to find and replace all instances of “http://website” in the wp_comments table of the WordPress database. Fortunately, SQL provides a simple way to find and replace data with its wonderful UPDATE function.
General Example
Using the SQL UPDATE command is straightforward. Here is the general syntax:
UPDATE table_name SET field_name = replace( field_name, 'string_to_find', 'string_to_replace' ) ;
Simply replace the table_name and both instances of field_name with ...
- Permanently Redirect a Specific IP Request for a Single Page via htaccess
- Not the most interesting title, but “oh well”..
Recently, a reader named Alison left a comment requesting help with a particular htaccess trick. She wanted to know how to permanently redirect (301) all requests for a specific page when requested from a specific IP address. In other words, when a visitor coming from 123.456.789 requests the page requested-page.html, the visitor will be redirected to just-for-you.html. All visitors not ...
- CSS Throwdown: Preload Images without JavaScript
- Clean, easy, effective. You don’t need no stinking JavaScript to preload your images. Nope. Try some tasty CSS and (X)HTML instead! Here’s how.. (only two steps!)
Step 1 — Place this in your CSS file:
div#preloaded-images {
position: absolute;
overflow: hidden;
left: -9999px;
top: -9999px;
height: 1px;
width: 1px;
}
Step 2 — Place this at the bottom ...
- Wrapping Your Head around Downlevel Conditional Comments
- [ Keywords: downlevel, conditional, comments, hidden, revealed, positive, negative, ie ]
If you think you understand the logic behind Microsoft’s downlevel conditional comments, you are sadly mistaken. Sure, they seem simple enough on the surface, but as you really try to wrap your head around how and why they work, the subtle complexities of downlevel conditional comments may leave you dazed and confused...
In our ...
- Computer Flashback: Windows 98 Run Commands
- [ Keywords: windows, 98se, 98, run, commands, command, dos, ms-dos, msconfig, regedit ]
Even with all the fancy-pants new features found in Windows XP and now Vista, Microsoft Windows 98 (Second Edition) remains our favorite Windows-flavored operating system. We love it so much, we still use it on one of our trusty laptops. Over the years, we have discovered several very useful functions available via ...
- Ultimate htaccess Blacklist
- [ Keywords: htaccess, rewrite, blacklist, block, deny, spam, spammers, scrapers, rippers ]
For those of us running Apache, htaccess rewrite rules provide an excellent way to block spammers, scrapers, and other scumbags easily and effectively. While there are many htaccess tricks involving blocking domains, preventing access, and redirecting traffic, ...
- Use PHP to Create Symbolic Links without Shell Access
- [ Keywords: symbolic, links, symlinks, symlink, shell, access, php ]
On Unix systems, a symbolic link refers to a file that points to another file or directory. Symbolic links serve as powerful tools for web designers and developers. Using shell access, creating a symbolic link requires only one line of code:
ln -s /home/username/public_html/directory1 /home/username/public_html/directory2
Simple enough. Assuming you have access to the linux shell. Unfortunately, many shared hosting environments ...
- Smooth Operators: Sharpen your Google Search Skills
- [ Keywords: Google, search, tricks, tips, hints, reference, cache, link, site, info, intitle, inurl ]
Coming soon to the World Wide Web: Everything. The perpetually evolving sum of human knowledge available online. Anywhere. Anytime. So, what are you looking for? Information concerning something, somewhere, about somebody.. You know it’s there somewhere. Sure, you could waste time by digging through that immense labyrinth of browser bookmarks, maybe eventually finding that one link that may or may not lead ...
- Go Back via JavaScript and PHP
- Use this simple code as a button that will return users to the previous page:
Here it is as a simple text link:
« Go back
You can make things easier by serving PHP and printing the link automatically. Here is the button link:
echo "";
And here is the PHP code to print a "Go back" text link:
echo "...
- Random Fixinz for Hotmail via Outlook Express
- 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 ...
- Hide Content on Windows 98SE
- This brief tutorial on hiding content applies to Windows 95, 98, and 98SE. Although this method may be old hat or even irrelevant, I have found it useful on a number of occasions, and therefore found it worthwhile to include here for the sake of prosperity.
On Windows 98SE (and others), it is possible to create a folder that is both listed and inaccessible via the Windows file system. Using an old DOS trick involving an obscure character ...
- Maximum and Minimum Height and Width in Internet Explorer
- Behold the seventh wonder of the virtual world: max/min-height and max/min-width properties are possible in Internet Explorer! Indeed, by taking advantage of IE’s proprietary CSS attribute, expression, you too can whip IE widths and heights into desirable proportions. The CSS expression attribute enables JavaScript commands to be executed within Internet Explorer. JavaScript via CSS? Thanks, Microsoft!
Why is this so great? Well, because in other, standards-compliant browsers, max/min-height and max/min-width properties are easily accomplished with this simple bit ...
- Rename the Recycle Bin in WinXP
- 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 ...
- Industrial-Strength Spamless Email Links
- In our previous article on creating spamless email links via JavaScript, the presented method, although relatively simple to implement, is not the most effective solution available. Spambots, email harvesters, and other online scumbags relentlessly advance their scanning technology, perpetually rendering obsolete yesterday’s methods.
In the case of spamless email links created client-side via JavaScript, many spambots now are able to decipher certain email addresses hidden within the JavaScript code itself. Spambots scan ...
- Keep it Dark: Hiding and Filtering CSS
- Hiding and filtering CSS rules for specifically targeted browsers is often a foregone conclusion when it comes to cross-browser design considerations. Rather than dive into some lengthy dialogue concerning the myriad situations and implications of such design hackery, our current scheduling restraints behoove us to simply cut to the chase and dish the goods. Having said that, we now consider this post a perpetually evolving repository of CSS filters..
Hide CSS from IE3, IE4, NS4
This method employs JavaScript ...
- Delete index.dat on Windows 98SE
- 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 ...
- Path to Outlook Express Files on WinXP
- 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.
- Embed External Content via iframe and div
- By using an within a , it is possible to include external web content in most any web document. This method serves as an excellent alternative to actual frames, which are not as flexible and definitely not as popular. Indeed, with CSS, the placement, sizing, and styling of div’s provides endless possibilities for embedding external or even internal web content into pages that would otherwise require the use of frames, Flash, or JavaScript. This method works ...
- Auto-Focus Form Elements with JavaScript
- After digging through the WordPress source code, I stumbled upon this very useful JavaScript method for auto-focusing form elements upon page load. Here is the JavaScript code (place within the document head):
function formfocus() {
document.getElementById('element').focus();
}
window.onload = formfocus;
...and corresponding (X)HTML markup (abbreviated for clarity):
In this example, the first form element ...
- Launch Multiple Programs with One Click
- Speed up your workflow by launching your favorite programs in one click using batch (.bat) files:
Create a folder and add shortcuts to your favorite programs.
Rename the shortcuts so that each consists of a single word.
Create a text file and change the name to something.bat.
Right-click on the .bat ("batch") file and select "Edit".
Emulate the following template according to your specific programs.
rem comments should begin with rem
rem note: this file launches all of my favorite ...