Category: WordPress


These are the plugins I add to every WordPress site I build for clients – current as of February 2011. Things change and this list evolves on a fairly regular basis as old plugins lose support and new ones come on the scene.

  • Akismet – To help reduce spam comments. Since this is now a paid plugin, I’ve started trying other free plugins, right now the one of choice is Growmap Anti Spambot Plugin. Growmap adds a checkbox to the comment form to confirm whether the commenter is human. Seems to work well in conjunction with Bad Behavior (see below).
  • All In One SEO PackI’m a longtime user of this plugin; I recently tried another that’s getting good feedback but it slowed my admin site to a standstill. Adds a meta title and description box to every post and page and has other fine tuning for search engine optimization.
  • Antivirus – Projects your blog against spam injections and viruses. Manage under the Settings menu in the admin sidebar and tick the checkbox for ‘Enable the daily antivirus scan.’
  • Bad Behavior – This plugin blocks spambots before content is served by looking at the delivery method and software being used by the commenter. It also connects to Project Honey Pot, a distributed system for catching spammers and spambots that works by embedding software in your website that collects info about IP addresses used for harvesting email for spam. Should be used with a traditional comment spam catcher.
  • Better Delete Revision + Revision ControlDelete old revisions to clean up your site. Use Revision Control to limit the number of post and page revisions that will be saved.
  • Broken Link Checker – It will let you update or delete broken links from a single admin page.
  • Google Analyticator – adds the site owner’s Analytics tracking code to each page and post.
  • Google XML Sitemaps – Creates an .xml sitemap and notifies Google, Bing, Yahoo and Ask.com when content is updated.
  • Login Lockdown – Limits the number of failed logins within a certain time period and records the IP address and timestamp of each failed login.
  • Secure WordPressRemoves common security holes at login, in theme files and in the admin area for non-admins.
  • TinyMCE AdvancedAdds more icons to the post/page visual editor box, including tables. Makes it a lot easier for the client to use if they don’t know HTML.
  • Widget Logicallows the use of conditional tags for widgets to control where they appear.
  • W3 Total Cache – Speeds up a site with browser, page, object, database caching and minify features.
  • WP-DBManager – This plugin helps you optimize and repair your database. Depending on the server settings you may be able to do backups and restores as well (sometimes backup doesn’t work correctly on some hosts). You can schedule optimization and backups to run automatically.
  • WPsyslog – For tracking all site activity and system events.




Akismet – To help reduce spam comments. Since this is now a paid plugin, I’ve started trying other free plugins, right now it’s Growmap Anti Spambot Plugin. Growmap adds a checkbox to the comment form to confirm whether the commenter is human. Seems to work well in conjunction with Bad Behavior.

All In One SEO Pack – I’m a longtime user of this plugin. Adds a meta title and description box to every post and page and has other fine tuning for search engine optimization.

Antivirus – Projects your blog against spam injections and viruses. Manage under the Settings menu in the admin sidebar and tick the checkbox for ‘Enable the daily antivirus scan.’

Bad Behavior – This plugin blocks spambots before content is served by looking at the delivery method and software being used by the commenter. It also connects to Project Honey Pot, a distributed system for catching spammers and spambots that works by embedding software in your website that collects info about IP addresses used for harvesting email for spam. Should be used with a traditional comment spam catcher.

Better Delete Revision + Revision Control – Delete old revisions to clean up your site. Use Revision Control to limit the number of post and page revisions that will be saved.

Broken Link Checker – It will let you update or delete broken links from a single admin page.

Google Analyticator – adds the site owner’s Analytics tracking code to each page and post.

Login Lockdown – Limits the number of failed logins within a certain time period and records the IP address and timestamp of each failed login.

Secure WordPress – Removes common security holes at login, in theme files and in the admin area for non-admins.

XML Sitemap Generator – Creates an .xml sitemap and notifies Google, Bing, Yahoo and Ask.com when content is updated.

Widget Logic – allows the use of conditional tags for widgets to control where they appear.

W3 Total Cache – Speeds up a site with browser, page, object, database caching and minify.

WP-DBManager – This plugin helps you optimize and repair your database. Depending on the server settings you may be able to do backups and restores as well. You can schedule optimization and backups to run automatically.

WPsyslog – For tracking all site activity and system events.

Boy, was this a huge pain to figure out. I’m hoping I can save others some teeth-grinding here.

CSS3 PIE is a wonderful addon that makes IE 6-8 render many of the most-used CSS3 features, including:

  • rounded corners
  • box shadows
  • text shadows
  • linear gradients
  • border images
  • multiple background images

It is super-easy to use on an HTML/CSS site, you simply add the PIE.htc file to your site and call the behavior like this in CSS:

#myElement {
    ...
    behavior: url(PIE.htc);
}

And if you can, add this to .htaccess (if you can’t do this for some reason, you can use PIE.php instead of PIE.htc in the CSS file):

AddType text/x-component .htc

Works like a charm.

But if you’re using WordPress…

We have a different story entirely. I was unable to get PIE working after several attempts, moving the PIE file, trying PIE.htc vs PIE.php, etc. What I’ll show you are the final edits that got it working for me. Note: I’m using a child theme of Theme Hybrid.

1) This is in my functions.php file:

function my_render_ie_pie() { ?>

<?php
}
add_action('hybrid_head', 'my_render_ie_pie', 8);

So you see you'll add all the CSS elements that need PIE treatment in IE, then the behavior line with a call to the PIE.htc file (I found that I had to use an absolute link, relative did not work for me on this WordPress site).

2) I added the AddType statement for .htc in my .htaccess file; if for some reason I hadn't been able to do that, I'd call PIE.php instead.

3) I removed the filters in every CSS element I included in functions.php (I was using a gradient filter for the buttons, and that hides the PIE results).

4) All the CSS elements involved were given position: relative.

Getting PIE to work in WordPress is tricky. There are some posts on the PIE forums that helped, but the part about the filter eluded me and that was the final issue to solve. There are other suggestions there that are reported to work in WordPress, but they didn't for me, maybe due to something about Theme Hybrid - I don't know. I did have another Theme Hybrid user confirm that what I showed above worked for him, too.

Let me know if this helps you!

My client who rents pop-up campers needed a simple, easy-to-manage guestbook for his redesigned website. He had a clunky script on his old site that he said had been nothing but a source of spam for years – could I do something better? Of course I could.

I looked into the available plugins; there were only a couple that were compatible with the current version of WordPress, and when I tried them I found they were not going to work, mainly because I couldn’t easily add the extra custom form fields I needed.

So I decided to make my own.  In WordPress I created a page called Guestbook. I used the TDO Mini Forms plugin to create my input form. It was easy to configure for moderation by my client and for Akismet spam protection.

Making the Input Form

I set the form to create a new post for each submission, submit it to the ‘guestbook’ category, then built a custom form. I used two custom field widgets (TDO Mini Forms widgets) for Name and Hometown, a content widget for the post name and comments, and then a simple one-question captcha. All of these widgets are drag-and-drop (there are many others available, including image uploader) and very customizable.

Once the form’s built, it can be hacked to rearrange fields, modify CSS, etc. You can also export a final copy of your form to a text file to later be imported for reuse on other projects.

Getting the Form Into the Page

I created a custom category template page where I limited the category to be displayed to ‘guestbook’ by using the ‘include’ parameter for wp_list_categories, set to category 10 (my guestbook posts) like this:

 __( 'RSS', 'hybrid' ), 'show_count' => true, 'use_desc_for_title' => false, 'title_li' => false, 'include' => 10) ); ?>

Then in WordPress I set my Guestbook page to use that new custom category template.

I used the TDO Mini Form widget to put the form into the sidebar on my Guestbook page. Nothing to do here really except restrict where it displays with Widget Logic:

is_category('guestbook')

Styling the Form

Custom styling of the form is easy, the file is /plugins/tdo-mini-forms/tdomf-style_form.css. I only made a couple of small changes, mostly redoing the ‘submit’ button to match the others on the site.

Styling the Page and Guestbook Posts

I added some text at the top of the page by putting it into the Description field for the category. Then I wanted to style each blog post with a border and some additional changes in presentation.

The CSS was simple – I made the posts narrower, put a larger margin underneath them, added padding, added a subtle background color and border, and made the headlines a little smaller and with a different font than the page headline:

div.category-guestbook {
margin: 10px auto 20px;
padding: 14px;
width: 90%;
background-color: #e4f1dc;
border: 1px solid #bec19c;
}
div.category-guestbook h2.entry-title {
font-weight: bold;
font-size: 20px;
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
}

Using Filter Hooks to Control What’s Displayed for each Post

I’m using Theme Hybrid, so this part was a little easier than it might normally be. Here’s a good overview of filter hooks and how to use them, and this is what’s built into Theme Hybrid. And, here’s a hooks database so you can see all the filter and action hooks available in WP 3.0.

What I wanted to do:

  • Remove the link from the post title
  • Change the byline to show only the publish date
  • Show all of the post content instead of an excerpt

I found that I can do all of this with hooks in my theme’s functions.php file.

/* Remove the link in the entry title on the guestbook posts */
add_filter ( 'hybrid_entry_title', 'guestbook_entry_title' );
function guestbook_entry_title( $title ) {
global $post;
if ( is_category('10') )
$title = the_title( '

', '

', false ); return $title; } /* Alter the guestbook byline */ add_filter( 'hybrid_byline', 'guestbook_byline' ); function guestbook_byline( $byline ) { global $post; if( is_category('10') ) $byline = ' [entry-published] '; return $byline; } /* Display full post content for guestbook category page */ add_filter( 'the_excerpt', 'guestbook_cat_content' ); function guestbook_cat_content( $content ) { global $post; if ( is_category('10') ) { $content = get_post_field( 'post_content', $post->ID ); $content = apply_filters( 'the_content', $content ); } return $content; }

Here’s the final product in action.

That’s pretty much it – now when someone submits a comment (that isn’t flagged as spam by Akismet) my client gets an email notification. He logs into WordPress and goes to TDO Mini Form’s moderation panel, and can then edit, trash or publish the post as he likes. A simple, solid solution that took less time than anticipated (which is always nice!).

This seems trivial, but it took me hours to troubleshoot this problem. I hope I save someone else from that.

WordPress custom post types are great – they make it so easy to create any kind of ‘cataloged’ posts, like a portfolio, or a library of DVD’s, or products to sell. I’m building a portfolio and testimonials using custom post types and for the most part this has gone really smoothly.

The one major hiccup was pagination. If you want to display say 10 custom posts on a page (an actual WordPress ‘page’) and then have the user be able to flip to the next page, you’ll need to use some kind of pagination like WP Page-Navi.

I spent hours trying to get paging to work on my testimonials, until I finally found a very important note in a discussion thread about custom post types:

You cannot create a Page using the same string name as your registered custom post type.

That means that if I register the custom post type ‘testimonials’ I cannot display it on a page named Testimonials. One of them has to be different.

Whew. I wish I’d found it earlier, but making that simple change fixed my pagination issues in a second.

On Saturday night I downloaded the Hybrid WordPress framework and installed it on the site where I’ll be reworking my main website. By Sunday afternoon, I was a total convert from WP Framework.

I learned more about advanced WP custom theming in a day than I have in the last month. Very excited to delve more deeply into Hybrid and all its possibilities.

There are a number of plugins and tutorials for adding a gravatar image to the meta info for WordPress posts.  But my client wanted the ability for each other to upload/maintain their own images within their WordPress profiles. Here’s how I did it.

First  I installed the plugin Author Image – this places a simple upload box at the bottom of a user’s profile page. Nice and simple.

Next, I used the code snippet provided for the plugin and added it to the .entry-meta section beside the author link in my template page:

<?php the_author_image(); ?>

I styled it to make it smaller, but again this was an easy task. Next, I wanted to make the image link to the author’s posts page – that proved to be harder than expected, but eventually I got it working thanks to a post I found about an outdated user image plugin:

<?php
$author_id=$post->post_author;
$curuser = get_userdata($author_id);
$author_post_url=get_author_posts_url($curuser->ID, $curuser->nicename);
echo 'user_nicename ) . '" ' . '>';
the_author_image();
echo '';
?>

Easy to implement and my client’s authors can control their image from within their profile rather than having to update a gravatar.

© 2012 position: relative; All rights reserved. Powered by WordPress.