How one WordPress plugin can replace many

When developing in WordPress the number of plugins can quickly escalate out of control. Fortunately there are one or two plugins that make others unnecessary.

It was Ryan Taylor who first pointed out my problem (one of them at least). I’m obsession with WordPress Plugins.

Whenever I get stuck with a problem on WordPress, I turn to plugins as the answer. However, the more plugins you add the more likely one will be badly coded, not updated or clash with another. In short, too many plugins is far from ideal.

As I have worked on the new boagworld.com website I came up against three little things that (with my limited experience) I didn’t immediately know how to code in PHP. Previously I would have looked for three plugins to solve these problems. Instead, I discovered one super flexible plugin that solved all three and a lot more besides.

More Fields

The plugin in question is More Fields and I would highly recommend it.

Essentially what the plugin does is put a nice UI over the top of custom fields. However, probably the best way to explain its benefits is to show the three places I am using it on the upcoming boagworld.com website. These three areas are…

  • Recommended tweets
  • Featured Posts
  • Custom Design

Let’s start with recommended tweets.

Recommended tweets

While wireframing I came up with the idea of putting a tweet box at the bottom of each post to allow people to quickly tweet their thoughts on the post.

My problem was that a blank box with the article URL wasn’t very inspiring. Although I could have filled it with a generic tweet like ‘Check out this great article’ it would be nice to have a custom message on a per post basis. That way if I added something tweet-able into a post I could pre-populate the twitter box with it.

Image of the tweet box on the new boagworld.com website

I could have used a custom field for this but bearing in mind my predisposition towards throwing a plugin at the problem I decided to go looking for one. That was when I discovered More Fields.

This allowed me to add a nicely formatted UI element into the edit page that allowed me to enter my custom twitter message.

The twitter box in the edit post page of WordPress

Then all I needed to do was call that field from within my template.


<script type="text/javascript">// <![CDATA[

twttr.anywhere(onAnywhereLoad);
function onAnywhereLoad(twitter) {
twitter("#tweetbox").tweetBox({
label: 'Twitter box',
defaultContent: "<?php
if (get_meta('tweetText') == '')
echo "Found this great post on @boagworld";
else
meta('tweetText'); ?> - <?php echo wp_get_shortlink(); ?> ",
height: 50,
width: 480,
});
};
// ]]></script>

The above code uses Twitter Anywhere to call the box but pre-populates it with my custom message if one exists using meta(‘tweetText’). If it does not exist it fills the box with a generic message instead.

Once I had set up More Fields it occurred to me it would allow me to get rid of a plugin I had previously installed; featured posts.

Featured post

You can also use More Fields to feature a specific post. I am using it to display features both on my homepage and on my category listing pages.

All you need to do is add a check box field and then return posts with the box checked in your template.

The featured post interface within WordPress post pages

The code for identifying featured posts is a simple modified WordPress loop.


 'featured', 'meta_value' => 1, 'posts_per_page' => 1, 'post_type' => array('post','episodes') ) ); ?>

Finally, I also realised I could use More Fields to solve my biggest problem, custom post designs.

Custom Design

Once in a while I want to publish a post with a slightly different design. The design is unique to the post and so a custom post type isn’t really the right choice. What I really need is the ability to add CSS on a per post basis.

One way of doing this would be using the unique post id attached to the body tag. The problem with this is that your CSS file would become bloated with stylings that most user may never need (as they aren’t visiting the associated pages).

The answer was to allow me to post inline styles associated with the specific post. Fortunately More Fields made that easy. I simply added a custom text box into the post and then called that from within my template. Job done.

Custom CSS field in WordPress admin interface.

Other alternatives

My wonderful and all-knowing twitter follows have told me about an alternative which is possibly even better. That is Magic Fields.

I have had a look at Magic Fields and it is impressive. It looks both more flexible and more powerful than More Fields. However, as with anything, with this extra power comes complexity.

In my case and I suspect many others, the functionality provided by More Fields is probably be more than enough. I am a simple man and so generally prefer the simplest solution that does the job!

That said, if you have worked with either or both plugins I would love to hear your comments below.

  • http://twitter.com/thelinden Barry Walsh

    I like advanced custom fields, buy the repeater feature and it knocks all the rest out of the water. It can specify what pages the fields appear on by the theme they use or you can select the exact page. That’s something I always thought More Fields was missing and could confuse clients if you have a custom field show up on a page edit screen when it’s not used on that page at all.

    The repeater feature (around 20 euro) gives a problem interface for custom fields that are more lists of data. It’s great for galleries as well. 

    http://wordpress.org/extend/plugins/advanced-custom-fields/

    • http://twitter.com/jmkenz James McKenzie

      Thanks for the heads up on the repeater feature.  I’ve been looking for that functionality for months!  (If anyone else is curious, the store is here: http://plugins.elliotcondon.com/shop/)

  • http://twitter.com/jamesckemp James Kemp

    I tend to always use one called Verve Meta Boxes. It allows you to add all sorts of custom fields, including text fields, text areas, selects, checkboxes etc – it’s truly awesome. Try using that with CMS Press, anything is possible!

  • jniden

    Still prefer magic fields

  • matthillco

    I found More Fields and Magic Fields a bit flaky in their execution. There are many other plugins that allow you to do similar things, and they all have strengths and weaknesses. Off the top of my head I can also think of

    Easy Custom Content Types (has Meta Box creation)
    Custom Field Template
    Verve Meta Boxes (was very nice, but no longer supported)

    For the coders who want more flexibility, you should also check out the awesome WP Alchemy class, which allows fully customised meta boxes including all your own HTML and CSS for making them look good. It also allows repeatable fields mentioned by Barry, and it’s FREE! Does require coding though — there’s no UI.

  • http://www.russellheimlich.com/blog kingkool68

    I wrote my own Meta Box framework to easily add custom meta boxes on the fly as a site I’m working on needs them. It’s nerdy and geared more to developers but you can control when they show up on the backend based on what categories are ticked.

    http://svn.kingkool68.com/projects/metabox/

    Search Regex is an awesome tool for doing search and replaces across all of your content. A must have for cleaning up old content or migrations http://wordpress.org/extend/plugins/search-regex/

  • http://twitter.com/PauldeWouters PauldeWouters

    very creative use of custom fields! and thanks Barry for the link to advanced custom fields, I’ll give it a try

  • elba00

    I would not recommend More Fields as it is not compatible with a whole bunch of other essential plugins. Although it was a big promise along with More Types, More Taxonomies and the never finished More Roles it looks the whole project has been abandoned for good. But the main reason I don’t recommend is that there is virtually no support and no updates/bugfixes. The More Plugins’ site itself is half-finished: http://more-plugins.se/plugins/more-fields/template-functions/

    There are other alternatives like Advanced Custom Fields. Be careful when developing WP sites, after choosing custom fields/taxonomy based plugins there is only a hard way changing them.

  • exotec

    In my lastest project I tried these plugins but in the end I took Drupal. If wordpress could get the flexiblity of cck or as of Drupal 7 now called fields (and with views you can do almost everything), it would be a much better cms (also wp could have better db-settings and language integration, instead wobbly plugins getting this job done).

  • http://www.manofgadgets.com Man of Gadgets

    Hmm makes more sense. I think it would be a great idea for WordPress designers to think about this when designing themes aswell to make everything that much more compatible and compact.

    http://www.ifitneverhappened.com

  • fldtrace

    Custom Field Template is far much better plus has the same text editor as main one where you can upload images. Easy to use by the client too.

  • http://twitter.com/jmkenz James McKenzie

    Here’s a premium plugin that does custom posts, custom fields, and custom taxonomies, all in one!

    http://premium.wpmudev.org/project/custompress

    Truly efficient.

  • Candide Chaboteaux

    I’ve used WordPress, Joomla and Drupal in the past and still
    do for certain clients. The thing about most of these content management
    systems WordPress and Joomla isn’t really built for complex environments. I
    work mostly in enterprise environment where a simple website is a portal or
    interface for a library full of documents. Drupal is a little bit more
    enterprise friendly but isn’t that easy to develop. A few years ago I was doing
    a google search for content management systems/portal and I came across
    Centralpoint by Oxcyon. Unlike WordPress and Joomla it was able to handle the
    more complex issue that they aren’t meant for. Centralpoint is better than
    Drupal because we got of 230 modules out the box and didn’t need a Drupal
    Expert to configure and develop our sites.

Headscape

Boagworld