51

From my experience as a Support Manager, I encounter a lot of “issues” with caching plugins in WordPress. It is good to understand what these plugins do (in general) and when to use them, and when not.

How WordPress Generates Pages

WordPress is a PHP/MySQL application. PHP stands for Hypertext Preprocessor. MySQL is a database system. PHP will take the code in WordPress, combined with code from your theme’s files (e.g. index.php), reads the database (containing your posts, widgets, plugins etc.) and merge all that into a plain HTML page.HTML being the “language” that browsers can read and display. This is a dynamic process, and will be performed each time a page is requested.

What a Caching Plugin Does

In general, a caching plugin will create a “snapshot” of all your pages to reduce the time required to generate an HTML page. Once a page has been generated by the process of reading a php file, get info (your posts, widgets etc) from the database, get and insert plugin info (e.g. “related posts”), once all the information is processed and a page is put together, a copy of the resulting HTML page will be stored in a folder on your server. This process is called caching.

When a browser requests a page, it will be served from those snapshots, from cache, thus reducing the time required to generate the page, and as such optimising the site load time. As soon as you change a page or posts content, or add a new post, the caching plugin will (re-)generate the cache for that page, so that future requests will reflect the updated version.

So What’s the Problem?

There really should not be a problem, unless you are still working on your site, developing, adding plugins and widgets, perhaps modifying CSS code or theme template files to change the functionality and looks of your site. Most, if not all of these activities do NOT trigger a cache plugin to regenerate all cached pages. So when a page is requested, chances are that the version that is displayed by the browser (the previous snapshot) does NOT reflect the CSS changes, widgets appear not to have been changed, plugins seem to malfunction etc.

What’s the solution

De-activating the caching plugin during the development stage of your site, can prevent these issues. In some cases, depending on the caching plugin you use, you might also have to clear the folder with the snapshots, the cached pages, but this requires you to access your server via ftp, and you need to be sure which files to remove. Be cautious, and always make a backup. Consult the plugin’s documentation on how to do this.

Being aware of this might save you a lot of headaches and confusion and “why is my page not updating, I can see the change in my WordPress backend, but not on the page!?”.

Every now and then, I get asked to do some customisations, and the one that regularly pops up is “I want to display posts in columns, {insert any number here} next to each other, just like in such-and-such (magazine) theme”. I created a piece of code that I am comfortable with, is easy to customise and adjust.

When another interesting request made it to my mailbox recently (“on my index page, I want to display 3 full width posts with the full content, followed by excerpts side by side”), I thought it was time to do a bit of polishing, and come up with a simple yet reusable solution.

I thought it might be worth sharing, so I decided to make it into a plugin, for the simple reason that it allows me to easily implement this solution on any site I am working on, without having to modify the theme template files (like functions.php, index.php or style.css).

So here it is, for you to enjoy and use as well. Note/disclaimer, it is by no means a “Formal Official WordPress Plugin” and I doubt it will make it to the WordPress plugin directory, but using a plugin is just easier “packing, shipping and handling”. Upon installation and activation, the plugin will not modify any theme files, database files whatsoever. If you don’t like it, or if it doesn’t work for you, simply delete the plugin folder, no harm done.

Read More→

Yesterday, Nov. 25, 2010, WordPress 3.1 Beta 1 was released for testing purposes. There’s a feature stop, which means that the beta testing period will be used to collect and squash any bugs that are found.

I had a quick look at what I thought were the most interesting “front-end” features, while the most promising backend feature without doubt it the new post-formats. I will however need more time to dive deeper into that, WordPress Lead developer Mark Jaquith has already published an excellent article on the new feature.

A quick browse and some visuals on the new features.

Read More→

Enhancing your WordPress 3 menus

WordPress 3 comes with integrated menu management. Although still a bit quirky at times, it makes creating and managing (navigation) menus a breeze. However, now that creating and displaying a menu takes nothing more than one line of code (wp_nav_menu), we appear to have lost the ability to “manually” add our own stuff.

For instance, by design, there is no “home” link on any menu. Though it is easy to create a custom menu item in the menu management, there is an easier way, using WordPress filters.

The navigation menu can be “filtered”, and so can the navigation menu items. This allows us to add menu items at will.

Inspired by a support request, I did a bit of digging, the result are the following three code snippets, that you can add to your themes functions.php file and will add a login/logout link, add a search field or a Home Page link to your WordPress 3 navigation menu.

Read More→

Since WordPress version 2.9, featured images (formerly known as “post thumbnails”) are integrated in the Write Post and Write Page panel. Not all WordPress themes make use of these fields, and a change to your template files is required.

In this post I will explain how you can add Featured Images to your posts and pages with only a modification to your functions.php file, and some basic styling using css. This is in particular useful when you have multiple Page templates, and therefore need to update several files to incorporate the featured images in each page.

More after the break.

Read More→

The new WordPress 3 navigation menus are an excellent tool to design your own menus, mixing pages, categories and custom links. iThemes created video tutorials on how to use the new WordPress navigation in Builder and Flexx theme. The following tutorial will show how you can replace the text links in the navigation menu with images. It can be used for any theme, on any WordPress site running WordPress 3+, but it is based on iThemes Flexx.

The Flexx theme, by design, uses graphical icons for the home page links, as can be seen in this theme demo. The WordPress 3 navigation won’t add these automatically.

In the following step by step guide, we will:

  • create 2 menus, one for pages, one for categories
  • create custom links to link to “home”
  • integrate the menus in the WordPress layout
  • figure out how we can address these links using CSS
  • add the necessary css to make it all work
Read More→

For an upcoming tutorial on the new menu system in WordPress 3, we need to identify each menu item, so that we can address that in our stylesheet. That way, we can add specific styling to a single menu item, which may be useful if you want to use images or icons in the menu in stead of text links. I haven’t found an easier solution (other than inspecting your site’s html source code once the menu is published), but I would love to get your input.

Read More→

The idea for this came from a request, where the customer wanted to allow users to register online, and then allow these users to be able to view a list of all other users that have registered. Regular site members, such as subscribers, editors, authors or contributors however should NOT be included, and neither should these (standard WordPress roles) have access to the page that lists these “special” users.

It is complicated to list users by Role in WordPress. There is no API or function in WordPress to create a subset of users based on their role. All (or most) examples I could find was to use the user-level assigned to each Role, but since that is deprecated since WordPress 2.0, I didn’t want to use that.

Rather than coding the entire functionality, I tried to use as much of the available tools, plugins and WordPress functions available. The solution I came up with consists of 2 plugins, a bit of configuring, and a bit of coding. All tied together it makes a nice way to implement additional CMS functionality in WordPress, without using a full membership plugin.

Note, this is not a “download and run” solution, but if you follow the steps, it will work, and hopefully will also give you an idea of what can be achieved with WordPress using plugins, a bit of code and your imagination.

Read More→

As seen on this site, designed and developed with the awesome Builder theme from iThemes, the header and footer stretch the entire width of the screen. Since Builder creates a fixed width container for your layout (based on the layout width you have selected), we need to do a little bit of extra work to achieve this.

This article will outline how to:

Builder WordPress theme Read More→

By popular demand, here are instructions to add icons to your site that will stick to the sidebar, even when scrolling up or down the page. Inspired by various resources that I found on the web, I’ve tried to put together a set of instructions that will make this as easy as possible.

The result will look like this (except in IE6, which will mess up).

Read More→