Tag: posts

Secure Visitor Posting for WordPress

Posted on June 1, 2009 in WordPress by Jeff Starr

[ ~{*}~ ] Normally, when visitors post a comment to your site, specific types of client data are associated with the request. Commonly, a client will provide a user agent, a referrer, and a host header. When any of these variables is absent, there is good reason to suspect foul play. For example, virtually all browsers provide some sort of user-agent name to identify themselves. Conversely, malicious scripts directly posting spam and other payloads to your site frequently operate without specifying a user agent. In the Ultimate User-Agent Blacklist, we account for the “no-user-agent” case in the very first directive, preventing a host of anonymous visitors from hitting the site.

In addition to empty user-agent strings, malicious requests for site content frequently fail to provide any referrer information. Unless special privacy software is being used, the web page from which a visitor has arrived at your site will be specified in the header information for that request. Likewise, when a visitor posts a comment at your site, the referrer string for that post request will be the URL of that particular page. Thus, as with blank user-agent requests, no-referrer requests are frequently indicative of spam and other malicious behavior.

Another important piece of information provided by all legitimate clients is the host request header. The host header specifies the Internet host and port number of the requested resource. This information is required for all clients making HTTP/1.1 requests. Thus, requiring the host request-header field for all posts to your site safely eliminates illicit requests from hitting your server.

Continue Reading

Better WordPress Archives via Dynamic Triple Column Layout

Posted on February 10, 2009 in WordPress by Jeff Starr

[ ~{*}~ ] Here at Perishable Press, the number of posts listed in my archives is rapidly approaching the 700 mark. While this is good news in general, displaying such a large number of posts in an effective, user-friendly fashion continues to prove challenging. Unfortunately, my current strategy of simply dumping all posts into an unordered list just isn’t working. I think it’s fair to say that archive lists containing more than like 50 or 100 post titles are effectively useless and nothing more than a usability nightmare. With growing numbers of blogs building up massive collections of posts, finding better ways to display vast quantities of archived material becomes increasingly important.

One solution that seems popular involves breaking the archives down into various categories, tags, and time periods. This provides meta-context to each list of titles and usually eliminates the need for any hideously long post listings. This solution works well, especially when the different category lists are displayed adjacently in multiple vertical columns. For example, a blog with three categories would do well to display each category’s archive listings in its own vertical column. Something like this:

Continue Reading

Critical Review of Dyasonhat’s Premium Smart Sort WordPress Plugin

Posted on January 17, 2009 in WordPress by Jeff Starr

After hearing about the recently released “premium” version of Dyasonhat’s Smart Sort Plugin for WordPress, I just had to give it a try. Occasionally working on projects requiring customized ordering of posts, I like to keep my utility belt well-equipped with any plugins or code techniques that will facilitate the process of man-handling post order. In this article, I discuss my experience with WP Smart Sort Premium.

Continue Reading

Fruit Loop: Separate any Number of Odd and Even Posts from any Category in WordPress

Posted on November 16, 2008 in WordPress by Jeff Starr

[ ~{*}~ ] Recently, I discussed how to implement a horizontally sequenced display order for WordPress posts in two columns. In that tutorial, I explain how to separate odd and even posts using a dual-loop configuration and PHP’s modulus operator. Such technique serves well a variety of configurational scenarios, but is limited to the display of the default (admin-specified) number of posts from all categories. In this tutorial, we adapt this odd-and-even loop configuration to accommodate a much greater degree of customization. Specifically, we will focus on separating any number of odd and even posts from any specific category or group of categories. Several additional configurational customizations will also be covered.

Continue Reading

WordPress Basics — Series Summary

Posted on September 15, 2008 in WordPress by Jeff Starr

One of my first article series, the WordPress Basics series walks beginning users through some of the most rudimentary but essential WordPress tasks. From logging into the WordPress Admin and creating posts to setting post options and uploading images, the WordPress Basics series takes absolute newbies from zero to published in less than an hour.

Once you feel comfortable working with the WordPress Admin, I invite you to explore the many other useful WordPress articles here at Perishable Press:

And, to stay current with future WordPress content from Perishable Press, I encourage you to subscribe to the Perishable Press RSS feed.

Multiple Loops and Multiple Columns with WordPress, (X)HTML and CSS

Posted on September 1, 2008 in WordPress by Jeff Starr

Recently, I have been getting a lot of requests for multiple-loop configurations in WordPress. It seems that multiple-column, multiple-loop configurations are in high demand these days, especially ones that display posts like this:

  • First column, first loop: display posts #1-5
  • Second column, second loop: display posts #6-10
  • Third column, third loop: display posts #11-15

Using WordPress and a little CSS, this configuration is relatively easy to accomplish. Let’s cut right to the chase..

Continue Reading

Another Exciting Perishable News Update

Posted on August 19, 2008 in Perishable by Jeff Starr

It’s been awhile since my last personal news post, and I figure that enough has been happening to warrant yet another exciting news update. Yay! ;)

So let’s see, first on my mind is the recent launch of the new design for Monzilla Media, the official site for my personal website and graphic design business. The first two versions of the site were single-page brochure sites, but this new version is fully loaded, featuring tons of portfolio content, business news, and service information. If you’ve got a minute, I would love to hear your feedback!

Continue Reading

WordPress Plugin: Authenticate Lite

Posted on August 6, 2008 in WordPress by Jeff Starr

[ Icon: Authenticate Lite ] Authenticate Lite is a follow-up version of the original Authenticate custom-content plugin for WordPress. Just as with the full version of Authenticate, Authenticate Lite enables universal and/or targeted inclusion of custom content for both feeds and posts. Ideal for adding copyright information, distribution policy, thank-you messages, custom links, special offers, etc. Custom content may be added to any location within posts or feeds — before, after, or even within post content. This highly flexible content-addition plugin works great on all 2+ versions of WordPress (i.e., 2.0, 2.1, 2.2, 2.3, 2.5+).

Usage examples include:

  • Selective display of targeted advertisements
  • Invite readers to take advantage of special offers
  • Add a copyright message or feed distribution policy
  • Include universal footer content for all feed content
  • Include universal footer content for all single-view posts
  • Improve the brand awareness of your site by adding a custom site logo
  • Add custom messages targeting site visitors, feed subscribers, or both
  • Send unique “thank-you” messages to subscribers and visitors
  • Spice things up by displaying a periodically updated thumbnail or banner image
  • Selectively include links and other information for a targeted collection of posts
  • Anything! This plugin provides an easy, versatile way to add custom footer content
  • Implement a plagiarism-detection string in all of your content for easy identification

Continue Reading

Open Call for Guest Posts at Perishable Press

Posted on July 26, 2008 in Blogging, Perishable by Jeff Starr

After much deliberation, I have decided to take a short vacation away from the computer. I have been working like a dog recently, and feel that a change of pace would help recharge the ‘ol brain cells. I haven’t decided exactly when it will be, but I am thinking that some time off in August (my favorite month) would be swell. Maybe go to the coast, do some traveling, take a long nap, or whatever. Technically, I haven’t taken a break from blogging here at Perishable Press in almost three years! So it’s definitely time..

Generally, I like to post three or four times a week, depending on my schedule. As most of you know, I like to post quality articles on just about anything related to Web development, graphic design, blogging, social media, SEO, site security, and just about anything related to technology, creativity, and design. Given a two-week hiatus, I am asking for help with around seven or eight guest posts, preferably from a few different authors.

Continue Reading

WordPress Tip: Disable Comments in Old Posts via PHP

Posted on July 8, 2008 in WordPress by Jeff Starr

Just a quick WordPress snippet for future reference. I recently explained how to disable comments, pingbacks, and trackbacks via SQL. Here’s a good way to do it via PHP:

<?php 
function close_comments( $posts ) {
	if ( !is_single() ) { return $posts; }
	if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( 30 * 24 * 60 * 60 ) ) {
		$posts[0]->comment_status = 'closed';
		$posts[0]->ping_status    = 'closed';
	}
	return $posts;
}
add_filter( 'the_posts', 'close_comments' ); 
?>

You can run this script as a plugin, through your theme’s functions.php, or through a custom user-functions.php file. Simply set the desired number of days by changing the number “30” to whatever you would like. As is, this script will close comments, pingbacks and trackbacks on all articles posted more than 30 days ago.

WordPress Plugin: Authenticate

Posted on June 29, 2008 in WordPress by Jeff Starr

[ Icon for Authenticate ] Authenticate is a free WordPress plugin that enables universal and/or targeted inclusion of custom content for both feeds and posts. Ideal for adding copyright information, distribution policy, thank-you messages, custom links, special offers, and much more. Custom content may be added to any location within posts or feeds — before, after, or even within post content. This highly flexible content-addition plugin works great on all 2+ versions of WordPress (i.e., 2.0, 2.1, 2.2, 2.3, 2.5+).

Continue Reading

WordPress Tip: Careful with that Autosave, Eugene

Posted on March 17, 2008 in WordPress by Jeff Starr

After upgrading WordPress from version 2.0.5 to 2.3.3, I did some experimenting with the “post autosave” feature. The autosave feature uses some crafty ajax to automagically save your post every 2 minutes (120 seconds by default). Below the post-editing field, you will notice a line of text that displays the time of the most recent autosave, similar to the following:

[ Screenshot: WordPress Autosave Message (Saved at 2:34:02.) ]

Surely, this relatively new feature provides an added layer of protection against lost work, but all is not perfect (yet) in the world of automatically saved content.

Several months ago, I lost several hours of work because the autosave feature completely failed to work, despite the periodically reassuring “Saved at..” message. After working for several hours with a false sense of security, WordPress choked and my post had vanished. In shock, I scoured the database for any trace of my recent efforts, but to no avail. The entire post had disappeared into the void. Utterly devastated and disillusioned, I decided to investigate the so-called “autosave” feature, learn what had happened, and take steps to avoid such travesty in the future. Here is a summary of my investigation..

Continue Reading

6 Ways to Customize WordPress Post Order

Posted on January 22, 2008 in WordPress by Jeff Starr

[ Graphic: Inverted Triangular Fractal ] Recently, reader Luke Knowles asked how to customize the sort order of his posts in WordPress. Looking into a solution to this question proved quite enlightening. Within moments I was able to discern 4 methods for modifying post order, and then several days later I discovered 2 additional custom sorting techniques. After updating the reply to Luke’s comment, it seemed like some good information that other WordPressers may find useful. So, here are six ways to customize the sort order of posts in WordPress..

Continue Reading

New Version of BlogStats PCC for WordPress 2.3

Posted on October 28, 2007 in WordPress by Jeff Starr

Just a note to announce the release of a new version of BlogStats PCC. BlogStats PCC is a free WordPress plugin that provides an easy way to share your blog’s core statistics with your visitors. You can show off any or all of the following statistics:

  • total number of posts
  • total number of comments
  • total number of categories
  • total number of registered users
  • total number of unregistered users
  • total number of individual, static pages
  • the date of the most recent post modification
  • a link to the most recently published blog post
  • a link to the name of the most recent commentator
  • date/time of the most recent blog update, displayed in your default date format

BlogStats PCC enables you to display any or all of these statistics in any location (inside the loop or elsewhere). The plugin is completely free, totally customizable, and extremely easy to use. The new version (2.3.0a) works with all versions of WordPress (1.5 - 2.3), and is available for immediate download via the official BlogStats PCC information/download page.

Much ado about nofollow: The Perishable Press Dofollow Series

Posted on September 23, 2007 in Function, WordPress by Jeff Starr

Okay, I know what you’re thinking: “Oh great, not another article about WordPress nofollow!!” Well, if that sounds like you, I have good news! This is the last post (at least for awhile, anyway) concerning all things nofollow, dofollow, and even no-nofollow, for that matter. In fact, this post isn’t even about nofollow! It’s simply a summary of the articles I have written involving nofollow-related topics. The articles fit together so well, one might suppose they were planned deliberately as a bona fide series. Hmmm.. I’ll leave it up to you to decide:

The Perishable Press no-nofollow/dofollow Article Series

  1. Death to Nofollow — when I first saw the light.
  2. Repenting of My Nofollow Sins — after a long, cold trip to the dark side.
  3. Comprehensive Reference for Dofollow Plugins — no more excuses for nofollowing links.
  4. The One-Minute Dofollow WordPress Upgrade — see how easy it is to upgrade your site.
  5. The Deluxe One-Minute Dofollow Upgrade — selectively remove nofollow attributes.
  6. Inustrial Strength WordPress Dofollow Upgrade — “wipe them out.. — all of them.”
  7. Nofollow Blacklist for Commentator Links — gain power over spam scum.
  8. WordPress Nofollow-Blacklist Plugins — nofollow blacklisting the easy way.
  9. Dofollow Whitelist for Commentator Links — reward your favorites with some dofollow love.
  10. The Ultimate Nofollow Blacklist — “this blacklist is now the ultimate power in the universe!”
  11. Much Ado About Nofollow: The Perishable Press Dofollow Series — one post to list them all!

..and with that, we now return to our regularly scheduled programming ;)

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

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

[ Image: Detail view of a series of mechanical gears (black and white photo) ] 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 to pimp it up tough with your own (X)HTML markup. This tight little loop is perfect for “latest-post” excerpts, “aside” posts, news/headlines, site updates, urgent messages, and so much more. And since it plays well with multiple loops, the configurational possibilities are simply endless. Ready? Let’s get on with it..

Continue Reading

Perishable Press Triple Loop for WordPress

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

Two of the themes developed by Perishable Press, Apathy and Information, depend on three WordPress loops to operate as intended. For each of these themes, the three loops consist of two "side" loops and one main loop. The side loops each display posts from one specific category, while the main loop displays posts from every category not specified in the side loops.

There are many different multi-loop configurations currently available for WordPress users. Needless to say, despite a wide variety of available loop setups, implementing a customized multiple loop frequently requires a great deal of time of energy. Certain loop sets accomplish one task, but fail at another, while others refuse to provide enough flexibility in general. Indeed, after countless rounds of trial and error establishing multiple loops, we finally developed the almost-perfect triple-loop configuration.

Continue Reading

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

BlogStats PCC Plugin

Posted on August 28, 2006 in WordPress by Jeff Starr

Announcing the BlogStats PCC plugin for WordPress! BlogStats PCC is the easy way to display the total number of posts, comments, categories, as well as several other great statistics for your WordPress-powered website. With BlogStats PCC, you display only the information you want, where you want — inside or outside of the WordPress loop. Completely customizable, BlogStats PCC will display any combination of statistics you choose. This plugin is highly flexible, simple to use, and completely free.

Update: New version of BlogStats PCC now available! The new version now provides all of these great site statistics:

  • Total number of posts
  • Total number of comments
  • Total number of categories
  • Total number of members
  • Total number of guests
  • Total number of pages
  • Date of most recent update
  • Most recent commentator
  • Most recent post

Display any or all of the provided site statistics — customize your own set to provide only the statistics you want!

Installation and Usage

  1. Unzip blogstats-pcc.zip and copy blogstats-pcc.php to your plugins directory.
  2. Upload and activate via WordPress plugin admin panel.
  3. Add any of the following calls to wherever you would like the information displayed:
Display the entire set of statistics in a nice list format:
<?php if (function_exists('fullstats')) { fullstats(); } ?>

Display the total number of posts, comments, and categories:
<?php if (function_exists('blogstats')) { blogstats(); } ?>

Display the total number of posts:
<?php if (function_exists('poststats')) { poststats(); } ?>

Display the total number of comments:
<?php if (function_exists('commstats')) { commstats(); } ?>

Display the total number of categories:
<?php if (function_exists('catstats')) { catstats(); } ?>

Display the total number of registered users:
<?php if (function_exists('regusers')) { regusers(); } ?>

Display the total number of unregistered users:
<?php if (function_exists('userstats')) { userstats(); } ?>

Display the total number of individual, static pages:
<?php if (function_exists('pagestats')) { pagestats(); } ?>

Display the date of the most recent post modification:
<?php if (function_exists('modstats')) { modstats(); } ?>

Display a link to the most recently published blog post:
<?php if (function_exists('recpost')) { recpost(); } ?>

Display the name of the most recent commentator as a link:
<?php if (function_exists('reccomm')) { reccomm(); } ?>

Display the date of the last update in your blog's default date format:
<?php if (function_exists('recstats')) { recstats(); } ?>

Download the Latest Version

Download BlogStats PCC [ version 2.3.1 | ~3KB | .zip | 902 downloads ]

Previous/Alternate versions of BlogStats PCC

Display the Total Number of WordPress Posts, Comments, and Categories

Posted on August 28, 2006 in Function, WordPress by Jeff Starr

Would you like to display the total number of posts, comments, and categories for your WordPress-powered website? Here is the code that can make it happen 1!

Update: The count posts part of this method should only be used for WordPress versions less than 2.5. For WordPress versions 2.5 and better, there is a built-in function for displaying the total number of posts. See The WordPress Codex for more information.

<?php
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts); 

$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms);

$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>
<p><?php printf(__('There are currently %1$s <a href="%2$s" title="Posts">posts</a> and %3$s <a href="%4$s" title="Comments">comments</a>, contained within %5$s <a href="%6$s" title="categories">categories</a>.'), $numposts, 'edit.php',  $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>

Here is a modified version of the code, customized for our use here at Perishable Press:

<?php
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
if (0 < $numposts) $numposts = number_format($numposts); 
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
if (0 < $numcomms) $numcomms = number_format($numcomms);
$numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
if (0 < $numcats) $numcats = number_format($numcats);
?>

<?php echo $numposts . ' posts and ' . $numcomms . ' comments in ' . $numcats . ' categories'; ?>

Footnotes

Press Time

Posted on July 24, 2006 in Perishable by Jeff Starr

After a few weeks of utter silence here at Perishable Press, it is time to post some fresh material. We have a few interesting — perhaps useful — articles coming up, including Website Attack Recovery, Lightbox/Tooltips Bug Fix, Even More Server Drama, and even a few posts covering recent events, tips, and other general nonsense. Things quiet down around here while we are working on new websites, but new content is always anticipated in between projects. We enjoy sharing insights and other news with readers whenever possible, and always enjoy hearing from visitors and guests. So, as the intense summer heat slowly boils us alive here in the Desert Oasis, we look forward to the imminent arrival of Fall, and all that that implies..

Customize Password-Protected Posts

Posted on May 22, 2006 in Function, WordPress by Jeff Starr

To customize WordPress-powered password-protected posts such as this one, follow these simple steps.

First open template-functions-post.php and find the function get_the_password_form, which is located near the top of the page.

There are several aspects of this function that you may wish to customize. For example, the Perishable Press website requires several CSS attributes for stylistic control. Thus we simply added the class postpassword to the form input field, as well as the class passwordsubmit to the form submit button. This enabled full stylistic control over password-protected posts. You may also wish to modify the size of the input text field, or even edit the submit-button text.

Finally, remember to check both the post comment view for proper “password message” display. If it is not, edit the local comments.php file (usually near the top) until the message displays correctly.

Getting into It

Posted on December 8, 2005 in Perishable by Jeff Starr

Several months since it began, the Perishable Press is finally being fleshed out with posts, feeds, and images. Now that the site is (95%) built, we are experiencing the joys of blogging, tweaking, and fine-tuning details. So if the site looks good but seems a little short on content, just give us time — there is much planned for the future. I am grateful for this website, and look forward to using it to its fullest potential.