The WordPress Mullet Plugin

The other morning I noticed a new WP theme called “Mullet”. Loving all things mullet, I checked out the page and some of the links on it.

I eventually arrived at Mullet Layout: A user-friendly front page and thought it’d be nice if you could just activate a plugin to get the user-friendlier mullet display of posts, instead of switching or modifying themes.

Not finding a plugin, I set out to write my first WordPress plugin. One day of frustration at The Loop (multiple loops, actually) and lots of perusing source code later, I’m pleased I can now give the whole world a mullet. Well, the WordPress world, anyway.

Download the Mullet plugin (version 0.4): 4.95kb

When you add the plugin to WordPress it’ll create a new Options sub-menu called Mullet where you can control what your list looks like, how long it is, etc. It’s pretty flexible.

Scroll to the bottom of this page (or the bottom of the my Home page to see what it does.

For more information on mullets (both hair and data related):
Wikipedia: Mullet (haircut)
Mullet Layout: A user-friendly front page
Mullet style blog layout

Version History

  • 0.4 2006-09-30 – Added ‘Page’ options and sample code (WP 2.1 Compatible, Tested 1/20/2007 on WP 2.1 RC2).
  • 0.3 2006-09-27 – Fixed html character encoding bug in titles/post names.
  • 0.2 2006-05-25 – Added date formatting option, per request.
  • 0.1 2006-05-11 – Initial (public) release.

Comments, suggestions and gratuitous praise welcome.

72 thoughts on “The WordPress Mullet Plugin

  1. Mullet works by attaching itself to the “end loop” event in WordPress that happens whenever you display a list of posts (or just 1 post — it all uses the same loop, so the same event happens).

    One of the early things I found when writing it was that if I had a “Recent Posts” sidebar section, Mullet showed up there too (same loop process, same event fires when it’s over).

    So, yes, if you put a Recent Posts section in your sidebar, Mullet will appear there.

    If you want Mullet to show up there without listing other posts, I’ll see what I can do. Kinda wondered if this would ever reach 0.2 anyway. πŸ™‚

  2. I’ve noticed I’d like to control that too… If/when I release the next version I’ll add that option.

    I’m leaving for vacation for a bit, so it’ll come after I return. Good news is, I’m taking a laptop with me so I can work a bit on it while unable to sleep on a lousy hotel bed. πŸ™‚

  3. I looked into the AquaFluid code, and it’s a nice looking theme, but it doesn’t use “The Loop” – the standard WP method of displaying posts and comments. Thus, the “end loop” event that WordPress offers for plugins like this one isn’t offered.

    The WP Mullet won’t appear on themes like that without editing the theme itself to call it… and at that point, I’d argue the theme should just be converted to use the WP standard coding conventions anyway.

    WP uses standards like “The Loop” for a reason, and while I like how that theme looks, I’d grade it poorly for being WordPress compatible, because it’s using different code behind the scenes.

    I looked for an author link, to inquire about getting the code changed, but couldn’t find an email address or the theme itself at any of the urls linked in the readme. Another sign of not-so-great authoring, imho.

    Sorry.

  4. Re: Date Format

    I’m working on a slight upgrade to the mullet code that’ll allow you to configure date formatting. Watch for it later this afternoon.

  5. Mullet version 0.2 has been released, now including the option to format dates. New feature suggestions are always welcome. Enjoy!

  6. Hi, I installed and activated the plugin; set the number of recetn posts to 10 and nothing displays on the front page (or selsewhere). I’m using a theme called “A new spring”, and it seems to have the loop, i.e. (?php if( $posts ): foreach ( $posts as $post ): start_wp(); ?) and (?php endforeach; // End looping ?). I don’t think I should have to manually call a function in my templates but I can’t think of something else to do to make it work. TIA.

  7. Here’s WordPress.org’s description of The Loop used in WordPress.

    You’ll notice that in WordPress 1.5 and later, it’s not a matter of if ($posts) but if ( have_posts() ). It’s likely the “have_posts” function that enables the end_loop filter that Mullet uses to know when to display.

    The Mullet plugin requires WordPress 2.0 or later (It may work with 1.5, but I haven’t tested it), and the theme you’re using must correctly implement “The Loop” as documented at WordPress.org.

    The reason it works on the WP-Email page is that WP-Email correctly uses “The Loop” to display the name of the post to be emailed.

    Sorry, I can’t fix incorrectly coded themes. πŸ™

  8. Something along the lines of

    <?php
    $ubm = new us_broome_mullet;
    $ubm->mulletize();
    ?>

    Should do it. I’ve not tried it this way, personally… let me know. πŸ™‚

  9. Didn’t work for me, but I found a way just to list the titles (no dates, no ordered list, and it includes the posts on the homepage).

    20 is the number of titles to list.

    I’ve just used your plugin at the bottom of the page, and the other on the sidebar.

  10. Hmmm, the code didn’t post, of course. Here, replacing * with the usual brackets.

    *?php wp_get_archives(‘type=postbypost&limit=20’); ?*

  11. To check how it’s displaying on other pages you can click on the ABOUT link on the homepage. Other pages are for subscribers only.

  12. My guess is that you’ve got WordPress configured to show 6 posts on the homepage. There are 6 posts in June (according to the About page). Then somehow, you’ve got the homepage stopping after showing just one post (from March).

    The mullet plugin reads WP’s “posts per page” setting from your WP options and thinks it’s supposed to skip 6 posts before starting its list.

    If you change that setting to “1” , your mullet should grow in correctly.

    Heh, I love mullet terminology.

    By the way (I can’t help this – I pay attention to church websites because the family business caters to churches)… I like your site (http://www.darbycreek.org/) and have a few ideas to offer. Take ’em or leave ’em, I don’t mind either way.

    I saw from your homepage that you’re in Hilliard, OH. I live in Michigan, so I was curious to know where in Ohio that is. Your homepage doesn’t have an obvious link to directions, though my closest guess to find it would be under Contact Us (left nav), or maybe About Us (top nav).

    “Contact Us” showed me an address, but no link to directions.
    “About Us” has a link to directions, but it’s listed between “Beliefs and Values” and “Meet our Staff”. Semantically, that’s close to implying (how’s that for wiggle words?) that the “Directions” page has something to do with how the church operates… like “Leave your shoes at the door, this is Holy ground, you infidel Michigan fan.” πŸ™‚ If you move it under “Contact Us” in the bulleted list, it’s clearer that it has something to do with reaching you.

    The Directions page has meeting times and good local maps, but you might want to add a link to Google Maps or Yahoo Maps so a nosey visitor can find Hilliard on a larger map, or get personalized directions from their own starting point.

    Of course, those just my own silly opinions. Do what serves you best. πŸ™‚

  13. Thanks so much for the suggestion on the church website. I’ll have our guy who works on it move a directions link to the front page.

    As for the missions website, I don’t know how to set the number postings to 1 JUST FOR THE HOMEPAGE. When I set the postings per page to 1 under the options in the Admin area, it sets it to one posting per page for EVERY type of viewing. For example, if I want to view the posts from a particular category or archive, it will limit my viewing to 1 post per page there also.

    Any ideas on how I can get the homepage mullets to list the front correctly without limiting the number of posts per page for every type of view?

    Thanks again so much!

  14. I went into Mullet.php and modifed FUNCTION MULLETIZE. I set the variable $displayNumPosts to 0 (zero). That seemed to allow me to do what I needed.

    Thanks!

  15. Feel like editing source? There’s a line in the mullet.php file that does a query for the homepage. Should look like this:

    if (is_home()) {
    $request = “SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_password =” AND post_date_gmt < '$now' ORDER BY post_date DESC LIMIT $displayNumPosts, $displayNumTailHome";Change it to look like this (note the 1 instead of the $displayNumPosts):if (is_home()) { $request = "SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status = ‘publish’ AND post_password =” AND post_date_gmt < '$now' ORDER BY post_date DESC LIMIT 1, $displayNumTailHome";Not tested, but should be right.

  16. Thanks, I did go into into Mullet.php and modifed FUNCTION MULLETIZE. I set the variable $displayNumPosts to 0 (zero). That seemed to allow me to do what I needed.

    Thanks!

  17. This is exactly what i’m looking for, but…..

    I am not sure what to do to get it working?

    I followed instructions for downloading and uploading to the server and setting options, but there are no instructions on what string of code to put in where exactly?

    Say for the homepage or the sidebar.

    any help would be appreciated!

  18. ok, it appears to be working on category pages but not on the homepage of the blog?

    Also, how would I get this to work on a page outside of the wordpress directory?

    Like the actually homepage of the site and not the homepage of the blog?

  19. It shouldn’t take any editing to your pages to get this to work – it’s triggered by an event that automatically fires in WP2.0+ when a list of posts is displayed — IF the theme you’re using uses “The Loop” (see comment #15 above) for displaying posts.

    If you want to list posts just anywhere, you don’t need this plugin. Just add this php where you want the list to appear:
    <?php wp_get_archives(Ò€ℒtype=postbypost&limit=20Ò€²); ?>

    Pages outside the WP directory would need to include the WP files that define these functions in order for them to work. Never tried it before, seems like it wouldn’t be too complicated.

  20. update:

    I got it working for the sidebar and the main area of all the other pages OTHER than the wordpress homepage?

    Any idea why?

    Also, im using wordpress 2.0.3

    I’d still like to know of a way to have this on my homepage outside of wordpress if possible!

    thx!

  21. What’s your url? Oh, and what theme are you using in WP? Kinda hard to see what’s possibly wrong without getting to see anything. πŸ™‚

  22. Wow, nice looking site. But I don’t think that’s the default theme.

    Check under WordPress’s Admin, on the “Presentation” tab, and let me know what it says the current Theme is. Then I can take a look at the code for the theme and figure out if the mullet code will work, or what to do to help out.

  23. Thanks for the complement JB! I have 8 workings days put into it so far…and trying to finish it by the end of the week.

    the current theme says:

    WordPress Default 1.5 by Michael Heilemann

  24. hmm…..not sure if your getting my comments or not. Keeps flagging me as spam.

    lol

  25. Thanks for the complement JB.

    The theme being used is:

    WordPress Default 1.5 by Michael Heilemann

    The default WordPress theme based on the famous Kubrick.

    Not sure if this comment will go thru, it keeps flagging me as spam.

  26. Thanks for the complement JB.

    The theme being used is:

    WordPress Default 1.5 by Michael Heilemann

    The default WordPress theme based on the famous Kubrick.

    Not sure if this comment will go through, it keeps flagging me as spam.

  27. Sorry about the spam. That’s SpamKarma getting medieval on you. I check comments about once a day and recover anything that ought to be here.

    So the impression I get is that you might’ve started with the default and heavily edited it? Check to see if it’s using the have_posts() function for displaying posts on the homepage. If that’s the case, then the mullet plugin should just work. If not,we can hack it. Somehow. I think. πŸ™‚

  28. JB,

    Thanks again for the help….sorry for the multiple posts!

    Yes, I started with the default and modified it quite a bit.

    Yes, I checked and it is using the have_posts() function on the homepage.

  29. I looked into the Kubrick code and couldn’t see a reason this wouldn’t work there… but if I can’t get my hands on your own code, I can’t be sure.

    Have you tried the other suggestions for getting the recent posts lists in other comments?

  30. hello i use mullet on my blog works just fine … i would like to know if the mullet plugin can be “tweaked” to do somthing for me:
    I have a blog set up to show 5 post per page. As far as i know (and i’ve been searching for some time) there is no plugin that can be set up to show somewhere on the main (index) page the titles of the post from the 2nd page, and on the second page the titles form the 3rd and so on … can somebody help me please? Is there a plugin that can do what i want ???
    PS … I am not that good at PHP … I only know the basics ….
    thanks …

  31. Sorry, mullet won’t do this. But that’s not a bad idea for another plugin some day…

  32. Good catch on that error. Mullet 0.3 is ready for download. Let me know if there’s any problems.

  33. JB, I have another bug in relation to static pages – that is not present in posts. On some of my static pages, I want to have the ability to add comments and trackbacks. But if I copy the single.php comments code to my page.php to display comments, then your mullet list is added immediately after the_content, and not at after the comments area as it behaves on posts. How can I address this bug?

  34. Heh. Happens on my own “About” page, too. I emailed you separately, but I’m also posting for others here… I’m looking into it.

    Might create a new option to control whether the mullet appears on “Pages”… or if I can figure it out further, move the mullet to appear below the comment form on them. Or both.

    I can’t work on it today (working), tomorrow’s looking good though.

  35. Version 0.4 is out, linked above as usual.

    This version:
    Now defaults to not showing itself on WP ‘Pages’.
    Includes the ability to override the no-show-on-pages default.
    Includes sample code (found on the Mullet admin page) that shows how to insert a mullet into a page wherever you want it.
    Adds admin options for controlling how many items appear in a ‘Page’ mullet

    Stewart, this one’s for you. πŸ™‚
    Thanks for the support.

Leave a Reply

Your email address will not be published. Required fields are marked *