Wordpress

Efficient Related Posts

Posted by Aaron D. Campbell | Tuesday, June 16th, 2009 | 28 Comments
, ,

There is a problem with related posts plugins, and Efficient Related Posts is fixing that by approaching the problem from a different direction and offering a very different solution. Basically, current related post plugins build the list of related posts on the fly when the user needs to view it. Since blogs tend to be viewed far more often than they are updated (often hundreds of times more often), these queries are run way more times than they need to be. This not only wastes CPU cycles, but if the queries are slow (which they will be if you have 1000s of posts and tags) then the user gets a poor experience from slow page loads.

Here are some of the statistics. On WordPress Informer, when it was very new (less than a month old) it had only 7 posts, and had received roughly 2000 pageviews. That’s pretty low, but lets take a look at it. About 700 of those visits were to the home page and about 1300 were to single post pages. If you only show related posts on single post pages (which is how we currently do it on there) then the related posts plugin has been run over 1300 times for only 7 posts, which is roughly 185 times per post! If I were to show related posts for each post on the front page then it would have run another 4000 times (which is a conservative estimate), bringing it to 757 times per post. If you think this seems excessive, lets take a look at the stats for Web Developer News. It has had over 13,500 page views in the last 30 days. About 750 were to the home page, about 140 were to other static pages, roughly 550 were to tag pages, and another 250 were to miscellaneous pages such as search pages. That leaves 11,810 visits to single post pages and 21 posts during that same time. That’s about 562 times per post! If I added related posts to the home page, tag pages, and search pages it would need to be run roughly another 15,000 or 1,276 times per post.

In addition to the simple waste of memory and cpu cycles, putting the calculation of related posts on the front end means that when they start to slow down your users are left with a bad experience and slow loading pages. And they will slow down eventually, if your site gets big enough. I just recently worked on a site with more than 6,000 posts and over 1,800 tags (they offer investing advice, and have a lot of tags that correspond to ticker symbols). At that point, some of the related posts queries were taking 10 seconds to run. That’s really slow. We can do better than that right? Well it’s not easy but I think we can.

Efficient Related Posts moves all this effort into the admin section, finding related posts when a post is saved rather than when the user views it. The advantage is that if the query is slow it happens less often and the post writer is the one that waits rather than the user (which I think is WAY better).

There are limitations. For example, since the related posts are stored as post meta data, we only store a certain number of them (10 by default, but you can set it to whatever you want). This means that if you decide you need to display more than 10, you need to have the plugin re-process all posts. I generally display up to 5 related posts, but store 10 just in case I decide to display more in some areas. Also, since the related posts are calculated when a post is saved, manually adding a tag through the database will have no effect on the related posts, although I recommend not doing that anyway.

Requires PHP5.

WordCamp San Francisco 2009

Posted by Aaron D. Campbell | Tuesday, June 2nd, 2009 | 3 Comments
, , , ,

As some of you already know, I went to WordCamp San Francisco last weekend. I took the wife (who didn’t attend WordCamp, but did come to the party) and had a great time taking in some of “The City” in the process. I went to the main event on Saturday, the WordPress Anniversary Party Saturday night, and also the developer day on Sunday. It was really nice to meet some of the people, and just get a feel for what a WordCamp is like.

When I first showed up on Saturday, they weren’t even ready to check people in yet. I tend to be quite prompt, so I was there a few minutes before eight, and they were still alphabetizing name tags. Luckily there was a nice little place to sit, with power for my laptop and free wi-fi (unsecured to be exact…). The plan was to tweet about the experience as @wpinformer, which is the Twitter account for WordPress Informer where you’ll be able to read more detailed posts about each speaker I listened to. once they were ready I checked in, and just a few minutes later I was passing the check in tables and overheard them turning away walk-ins because they were already overbooked. I don’t know what the actual totals were, but I’m guessing there were about 800 people in attendance.

I ended up attending the welcome by Matt Mullenweg, “Cooking With BuddyPress” by Andy Peatling, “Straight from Google: What You Need to Know” by Matt Cutts, State of the Word by Matt Mullenweg, “Your Business Web” by Dave Gray of XPlane, “Customizing Themes and Plugins” by Ann Oyama, “Even Faster WordPress Themes” by Steve Souders, “FAILs, LOLs and User-Generated Content” by Scott Porad, “Lessons from Mozilla” by John Lilly, and the Goodbye by Matt Mullenweg. The fact that there were two tracks means that I missed a lot, but I was able to see pretty much everything I wanted to.

The tracks were upstairs and downstairs, with the main room being upstairs. The welcome by Matt Mullenweg was extremely quick and generic. It served as a kind of kickoff, but I honestly could have skipped it and just started downstairs at the first speaker.

The first real presentation I saw was “Cooking With BuddyPress” by Andy Peatling. You can read Why BuddyPress to get more detail about what I thought, but overall it was a really great session. Andy obviously knows what he’s talking about (he is the lead developer of BuddyPress), but he’s also good as conveying that knowledge to his audience. It was nice to hear a little of the history of the project (421 days to version 1.0) and some of the plans for the future (such as better BBPress installation), but the best thing was getting a quick overview of how BuddyPress worked, what it did, and how it could be extended and customized.

Next I went back upstairs to listen to “Straight from Google: What You Need to Know” by Matt Cutts. Matt is the head of Google’s Anti-webspam department. His job is to find those spam sites that plague the internet, and make sure that Google doesn’t offer you links to those kinds of sites in your search results. Since he spends so much time dealing with Google’s algorithms, he’s extremely current on best practices in Search Engine Optimization. The biggest thing to take away from this talk was that Matt said that WordPress is a “great choice” for SEO because it solves “80-90% of Search Engine Optimization (SEO).” That’s really saying something coming from one of the true experts out there.

After that, everyone came upstairs for “State of the Word” by Matt Mullenweg, whoch actually continued with a question and answer session after lunch. We got a lot of the normal history, WordPress was a fork of B2 and was later officially recognized by the B2 creator as the “official” continuation of B2, etc. There were a couple interesting WordPress facts such as that plugins were introduced in WordPress 1.2 and themes were introduced in WordPress 1.5. He also gave his summary of GPL Freedom to use software for any purpose, freedom to modify software, and freedom to redistribute. Then he talked about the fact that WordPress.org would be featuring themes that had paid support available, which he sees as perfectly in line with the essence of the GPL (and I agree). Alex King was brought up to talk a little about Crowd Favorite which now has eight full time staff in Denver and WordPress development and support is their primary revenue stream.

The Internet According to Dave Gray After the Q & A with Matt, I went downstairs to listen to “Growing Your Business Web” by Dave Gray of XPlane. Dave started by saying his slides sucked and wouldn’t be available for download, but I disagree. As a matter of fact, I loved “the internet according to Dave Gray” which spread pretty quickly across Twitter (so I’m not the only one). The whole talk was great, but was unfortunately cut short because he was going over his allotted time. It would have been nice to let him go a few more minutes, but I understand that they needed to keep things going.

Next up was “Customizing Themes and Plugins” by Ann Oyama, again downstairs. Ann was extremely nervous, and it showed. I was fine with that, I get nervous too. It seems like she knew most of the material, and I credited her nervousness with the bits that she seemed to leave out, skip over, or jumble up. Unfortunately, some of the information she gave was simply wrong. For example, functions.php and plugins are not really “the same thing.” They are loaded at different times, so they can do different things. For example, plugins are loaded before pluggable.php and can therefore override about 43 functions (depending on the version of WordPress) that functions.php cannot. Plugins can also modify settings before the global $wp_query is set up, which can be extremely handy. There are more differences as well, but that’s not really the point. Nervousness aside, there was some misinformation and while many of the people in the room will never need to know the differences (and some of the people there already knew), it’s still pretty unfortunate.

After Ann, things really picked up. Next was “Even Faster WordPress Themes” by Steve Souders, who wrote “High Performance Web Sites” and “Even Faster Web Sites” (both must reads in my opinion). Steve has spent time optimizing web performance for companies like Yahoo and Google, and he really knows his stuff. A lot of it was repeat info from his books, but it was definitely extremely useful information.

Following Steve was “FAILs, LOLs and User-Generated Content” by Scott Porad. He went over some of the highs and lows of having users generate your content for you. Steve Porad is the CTO at Pet Holdings, Inc. (aka lolcats) and I think everyone will agree that they’ve definitely succeeded at user generated content. They also run completely on WordPress.com, which really says something for WordPress.com.

For the last full session of the day I listened to “Lessons from Mozilla” by John Lilly. I loved his style of talking. He was a little ADD, running a lot of tangents…which reminded me of…well…me. He offered no “magic” key to succeeding as an open source project, which I respect because I don’t think one exists. However, he did give a good picture of what it’s like at the top of the food chain, with no one to copy or follow. It had been a long day, and I was tired, so I slacked off on tweeting as well as notes. I wish I hadn’t.

The day ended with the Goodbye by Matt Mullenweg. It was nearly as quick as the welcome, but by the end of the day it didn’t seem so bad. The big announcement? Don’t forget about the sixth anniversary party at the Automattic lounge. The party was nice, but let’s face it…we geeks aren’t all that outgoing. It seemed pretty dead by about 10pm when I left. So what was the best part of the conference? Definitely the developer day on Sunday, which I promise to write about soon.

WordPress Upcoming Posts Widget

Posted by Aaron D. Campbell | Tuesday, April 28th, 2009 | 5 Comments
, ,

Upcoming Posts Widget acts very much like the recent posts widget, but displays scheduled posts instead of published ones. It may eventually have options to show drafts too, but the jury’s still out. Requires 2.8+ (WP_Widget is nice).

The WordPress has-patch marathon

Posted by Aaron D. Campbell | Thursday, April 16th, 2009 | No Comments
,

Xavisys is participating in the WordPress 24 hour has-patch marathon. We’ll update this post as we go, but wanted to encourage others out there to participate as well. Grab a ticket and get started!

#8014 has been fixed as part of the marathon.
Now you can use dbDelta() with SQL containing backticks!
#9507 has been fixed
You can now localize the “tag” word in the new plugin page
#9408 has been committed
WAI-ARIA landmark roles have been added to the default theme to increase accessibility
#5710 – wp_tag_cloud should echo get_tag_cloud
For this one, my patch was replaced with a better solution offered by DD32 which added an echo option to the args array for wp_tag_cloud
#9472 – Fixed
Now wp_list_pages() applies the “current_page_item/parent/ancestor” classes when browsing image/attachment pages!
Some new filters were added
I always like to see new filters. It means that plugins can be more powerful. They added wp_trim_excerpt and admin_footer_text so far.
#9442 – Login UI
They added a password recovery link to the login error messages

Better Text Widget

Posted by Aaron D. Campbell | Monday, April 13th, 2009 | 1 Comment
, ,

WordPress has a built in text widget, but it has one major flaw. There’s no good way to apply styles to individual text widgets. This simple plugin adds a class to each text widget. The class name is generated based on the title of the widget, and makes it very easy to have that fine-grain design control you need.

WordPress Twitter Widget Pro 1.3.0 released!

Posted by Aaron D. Campbell | Saturday, April 11th, 2009 | Comments Off
, ,

I just uploaded version 1.3.0 of my WordPress Twitter Widget Pro plugin. It has been updated to allow HTML in the title and error message, which will allow for more inventive titles (like the one currently being used in the sidebar here). Additionally, the plugin no longer relies on you having a caching solution installed and set up. It now caches the tweets for 5 minutes using the built-in blog options functionality. Twitter limits the number of requests you can make in any given hour, so this caching should greatly reduce the number of times you see the “twitter not available” error message. Lastly, we phased out the old Snoopy class in favor of the new HTTP class.

Please discuss this plugin on the WordPress Twitter Widget page.

Exciting new things in WordPress 2.8?

Posted by Aaron D. Campbell | Friday, April 10th, 2009 | 3 Comments
,

WordPress 2.8 is slated to be released late this month. Unfortunately, I’ve heard a lot of talk that 2.8 isn’t anything to get excited about. People are saying that it doesn’t have a lot of new features. As a matter of fact, in the WordPress Weekly PodcastEpisode 49 Were You Fooled?, David Peralty even said that it only had “stuff that should have been in WordPress already”.

While I agree that 2.8 will have fewer noticeable new features than 2.7 did, it definitely has plenty packed into it. First, more than 270 tickets have been closed for 2.8, over 240 of those were set to “fixed”. Many of the changes in WordPress 2.8 are cleaning up what was added in 2.7, as well as strengthening the foundations of the core code.

The widgets code has been completely reworked and all the core widgets have been updated to use the new WP_Widget class. Personally, I think it’s pretty exciting! Previously, writing widgets that followed the multi-widget pattern (the ones that can be used more than once, like the text widget) was a real pain. Using the old widgets methodology, the text widget was 104 lines of code, and rather confusing. The new WP_Widget class has reduced that to 39 lines of considerably simpler code. I’m looking forward to updating my WordPress Twitter Widget, Gallery Widget Pro, and Get Free Web Designs Widget. I also plan to release a few new widgets using the new framework.

Another new feature in 2.8 that I find important, is support in the Admin UI for taxonomy descriptions. Currently in the WordPress admin interface, you can add descriptions to categories, but not for tags or any custom taxonomy. Since categories, tags, and other terms are all the same now, there’s really no reason you shouldn’t be able to control the description of all of them. The patch that was committed (which I submitted), adds a description box to the tag/taxonomy forms in the admin section, adds a description column to the tag and custom taxonomy tables in the admin, and adds two new helper functions for use in your theme called tag_description and term_description.

Here are some other things I find interesting that are new in 2.8:

In the end, the changes may not be as flashy as they were in 2.5 or 2.7, but 2.8 is a solid step forward for WordPress.

Manual Related Links

Posted by Aaron D. Campbell | Monday, April 6th, 2009 | 12 Comments
,

This WordPress plugin allows you to manually enter links that are related to a post. They can be on any site and you can enter just the URL or an entire link (specifying the title attribute, onclicks, etc). Additionally, since the links are stored at post meta data instead of being re-generated for each page view, the load on the server and the wait time for your users is MUCH lower!

You can use the helper functions to display the related links in your theme or you can simply tell the plugin to automatically add them to posts or even just single posts. The list of links is output as a semantic unordered list (ul) with an optional title. Everything is well classed to make CSS styling easy.

This plugin is not an automatic solution like many related posts plugins, but works well for people who want total control of the related links (or have multiple sites they want to link between).

Get Free Web Designs Widget

Posted by Aaron D. Campbell | Thursday, February 12th, 2009 | 2 Comments
,

Not long ago Xavisys launched a new sister site, Get Free Web Designs. Now we’re releasing a WordPress plugin designed to give you a chance to take part in the action. The Get Free Web Designs Widget allows you to display a feed of the most recent designs from Get Free Web Designs right on your blog.

Worried about hotlinking to images that load slowly? Don’t! This plugin will cache the 20 most recent design thumbnails in a directory inside your uploads directory. They’ll load as quickly as everything else on your site. Then, when they get too old to show in the widget, they are removed, which means they’ll never waste space on your site.

If you want to see this plugin in action, check out Web Developer News or Attackr – Designer News.

Fellowship of San Diego

Posted by danieltyack | Saturday, October 11th, 2008 | 1 Comment
, , ,

The Fellowship of San Diego is located in the heart of San Diego and was in desperate need of a site redesign. They were looking for something modern and simple and they needed it to be easily manageable by office staff. We built the site on a Wordpress content management system and they absolutely love the ease of editability. The site features blogging, integrated google maps, easily manageable contact forms, photo gallery with lightbox, new media integration, online giving and tons of other usable tricks. Not to mention the design looks GREAT!
www.fellowshipofsd.com