Fall Sale! Save 25% on WordPress books with coupon code: FALL2017 Shop Books »
Tag Archive

Five-Step Feed-Portfolio Makeover

Recently, I found myself drowning in an ocean of RSS feeds. Even after switching to Google Reader, which definitely speeds up the process of plowing through posts, I was wasting too much time consuming subscribed content. Thus, in an effort to find balance between saving time and staying current, I executed the following five-step feed portfolio makeover: Drop lame feeds. Previously, I had subscribed to a number of feeds simply because they were recommended or mentioned in an article somewhere. Unfortunately, sound referrals and interesting commentary do not necessarily equate with strong syndicated content. I often found myself reading post […] Read more »

Stop WordPress from Leaking PageRank to Admin Pages

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 […] Read more »

Eliminate 404 Errors for PHP Functions

Recently, I discussed the suspicious behavior recently observed by the Yahoo! Slurp crawler. As revealed by the site’s closely watched 404-error logs, Yahoo! had been requesting a series of nonexistent resources. Although a majority of the 404 errors were exclusive to the Slurp crawler, there were several instances of requests that were also coming from Google, Live, and even Ask. Initially, these distinct errors were misdiagnosed as existing URLs appended with various JavaScript functions. Here are a few typical examples of these frequently observed log entries: https://perishablepress.com/press/category/websites/feed/function.opendir https://perishablepress.com/press/category/websites/feed/function.array-rand https://perishablepress.com/press/category/websites/feed/function.mkdir https://perishablepress.com/press/category/websites/feed/ref.outcontrol Fortunately, an insightful reader named Bas pointed out that the […] Read more »

Super Loop: Exclude Specific Categories and Display any Number of Posts

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 posts Play nice with additional loops on the same page In this article, I present the swiss-army knife of WordPress loops. This highly versatile, “super” loop is standard WordPress code, easily implemented, and fully equipped to handle all of the custom behaviors mentioned above. Further, the PHP employed is self-contained, making it ultra-easy […] Read more »

Temporary Site Redirect for Visitors during Site Updates

In our article Stupid htaccess Tricks, we present the htaccess code required for redirecting visitors temporarily during periods of site maintenance. Although the article provides everything needed to implement the temporary redirect, I think readers would benefit from a more thorough examination of the process — nothing too serious, just enough to get it right. After discussing temporary redirects via htaccess, I’ll also explain how to accomplish the same thing using only PHP. Read more »

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 your specific information, and then edit string_to_find, and string_to_replace with the desired values. This is pretty standard stuff, but it is always a good idea to backup your database before […] Read more »

Another Mystery Solved..

Recently, after researching comment links for an upcoming article, I realized that my default <input /> values were being submitted as the URL for all comments left without associated website information. During the most recent site redesign, I made the mistake of doing this in comments.php: … <input class=”input” name=”url” id=”url” value=”[website]” onfocus=”this.select();” type=”text” tabindex=”3″ size=”44″ maxlength=”133″ alt=”website” /> … Notice the value=”[website]” attribute? It seemed like a good idea at the time — I even threw in a nice onfocus auto-highlighting snippet for good measure. I ran the form with this in place for around eight weeks before finally […] Read more »

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 coming from that specific IP address are not redirected, and thus will see the originally requested page. Further, the redirect must apply only to requested-page.html, such that every visitor — including the […] Read more »

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 of your (X)HTML document: <div id=”preloaded-images”> <img src=”https://perishablepress.com/image-01.png” width=”1″ height=”1″ alt=”” /> <img src=”https://perishablepress.com/image-02.png” width=”1″ height=”1″ alt=”” /> <img src=”https://perishablepress.com/image-03.png” width=”1″ height=”1″ alt=”” /> </div> ..and that’s a wrap! All images are preloaded and ready for calling as you please. Completely valid, […] Read more »

Wrapping Your Head around Downlevel Conditional Comments

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 previous article on Internet Explorer’s exclusive browser-detection method, downlevel conditional comments (DCC), we present an introductory exposition, defining expressions and providing several generalized code examples. Overall, it is a very useful article but partially fails at explaining the logic and functionality behind conditional comments. In this […] Read more »

Computer Flashback: Windows 98 Run Commands

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 the command line or even the “Run” prompt (Start → Run…). Anyway, without spending too much time researching or explaining these wonderful tools, we figured posting the information online may prove beneficial at some point in the future. So, without further ado, we present this working repository of helpful MS […] Read more »

Use PHP to Create Symbolic Links without Shell Access

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 deny shell access. Fortunately, creating symbolic links — also called “symlinks” — remains a possibility via the PHP symlink() function. Check it out.. Read more »

SEO 101: Best Practices

After studying Peter Kent’s excellent book, Search Engine Optimization for Dummies, several key methods emerged for optimizing websites for the search engines. Although the book is written for people who are new to the world of search engine optimization (SEO), many of the principles presented throughout the book remain important, fundamental practices even for the most advanced SEO-wizards. This article divulges these very useful SEO practices and organizes them into manageable chunks 1. Text Essentials The golden rule for developing a popular website is to create a useful site and share it with as many people as possible. When designing […] Read more »

Go Back via JavaScript and PHP

This quick tutorial explains how to use HTML, JavaScript, and/or PHP to enable visitors to “go back” to the previous page. You can use either method to add a simple “go back” link or form button to your web pages. Read more »

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! Read more »

Latest Tweets New video tutorials for USP Pro! Over 3 hours of practical, hands-on techniques and tips. 31 videos in HD format :)… twitter.com/i/web/status/91928…