Reorder Gallery now in WordPress Core

Less than a week ago, I released a new WordPress plugin called “Reorder Gallery” which gave you the ability to change the order of your images when you uploaded them, so that the gallery shortcode would display them in an order of your choosing. Two days later, Matt Mullenweg stopped by to say that it “would be pretty cool functionality for core WP” so I offered to add it in. It’s now done, and you can look forward to seeing it in WordPress 2.6.

Read more

Adobe's take on WordPress vs MovableType

To be fair, this is actually an “Adobe employee’s personal take” (as Anil Dash pointed out) on this situation. My post is not meant as a slam to Movable Type, I simply found humor in the quote on the Adobe blog.

Powered by a blogging system that\'s not as good as WordPress but still tries really hardWhile helping out in the WordPress IRC channel today, someone sent me a link to an Adobe Blog called Penguin.SWF, which tracks development status and issues regarding the Linux version of Adobe’s Flash Player. In case they change it, this image is from the bottom of the right sidebar. The exact text is “Powered by a blogging system that’s not as good as WordPress but still tries really hard” and “tries really hard” links to MovableType.com.

WordPress and Movable Type are competing platforms, but recently that competition has come to a boil. Anil Dash, Six Apart’s Chief Evangelist, took some shots with a blog post titled A WordPress 2.5 Upgrade Guide where he asserted that Movable Type was the upgrade that WordPress installs needed. Matt Mullenweg, WordPress founder, fired back in a Twitter message that said “six apart is getting desperate, and dirty” to which Anil replied “desperation is resorting to name-calling and slander instead of substance — if there’s a factual error, i’m glad to fix it.

The barrage went on for weeks, spilling into blogs, forums, and ultimately into the community itself. I’m not going to get into my personal take on the situation right now, that’s for another, much longer, post. Suffice it to say that I develop WordPress sites, write WordPress plugins, and contribute code to WordPress. What I find much more interesting is that someone over at Adobe, on the Linux version of Adobe’s Flash Player, is revolting because they don’t like Movable Type.

The Heart of Open Source

I really wanted to talk about open source software, how it relates to Xavisys and specifically me, why I believe in it, and why I support it. I knew that before I did, I needed to address the issue of profiting from open source. Take the time to read that, it will give you a more accurate picture of my relationship with open source, as well as some tips on how you can benefit from a similar relationship.

I personally love open source, because I love the idea of benefiting others. I enjoy giving someone else an advantage that they wouldn’t otherwise have. Take WordPress for example. It benefits two sets of people, the users who get a better experience and better functionality, as well as the companies and developers who use it as a platform to build on. Sure, some of those companies are competitors, but I want them to succeed too. I certainly don’t want to move ahead in life at the expense of others, I’d much rather move ahead by helping others. In the end we can all benefit. Whenever I hear the saying “It’s lonely at the top,” I can’t help but think that maybe they did something wrong then. If they’d have worked with people on the way to the top, and brought them along for the ride, they wouldn’t be so lonely. That’s my goal.

How to Profit with the Open Source Community

I love open source software. I love the idea of open source software. Involving people in the development process that would not otherwise get the chance. Tapping into talent that would not normally be available to you. Best of all, giving everyone the opportunity to benefit others as they benefit themselves. I’m always interested in how I can benefit the communities that I’m a part of.

The question that I’m asked most often when I talk to people about open source software is “Who pays for all this?” as well as variants like “Then how do they make money?” or “Won’t people eventually stop working for free?” We live in a capitalistic society, and people don’t understand why someone would work for free when they could be making money. In this article, I’m not going to cling to ideals on why doing something for the community shows more worth than your bank account balance, instead I’m going to explain how open source developers (myself included) do in fact make money by developing quality software for free. Hopefully in the process you will find a way to give back to the community and get your piece of the pie.
Read more

WordPress 2.5 Shortcodes

Warning: Shortcodes are affected by Trac ticket 6444, which was fixed in WordPress 2.5.1.

First I touched on the topic in my first impressions of WordPress 2.5. Then I whined a little about the tickets relating to them, and eventually I released my Google Maps Plugin that uses them. In the end, WordPress’s new shortcodes are really nice.

What are they?

First of all, a shortcode called “mycode” can look like any of these:

[mycode]
[mycode foo="bar" id="123" color="red" something="data"]
[mycode]Some Content[/mycode]
[mycode]<p><a href="http://example.com/">HTML Content</a></p>[/mycode]
[mycode]Content [another-shotcode] more content[/mycode]
[mycode foo="bar" id="123"]Some Content[/mycode]

As you can see, shortcodes allow a user to put a code into a post or page, and a plugin can then easily handle those codes. They can be nested, contain content (including HTML), attributes, etc. Sounds great, but how can you leverage shortcodes for your benefit?

How can I use them?

You want to leverage the new, powerful shortcode system in WordPress 2.5, but where do you start?
Read more

WordPress 2.5: First Impressions

WordPress 2.5 was recently released. I’m not your average WordPress user, I develop plugins, test the upcoming releases, and even contribute to the core when I can. Why do I say all this? I hope it will give you an idea where I’m coming from, as I share my first impressions of WordPress 2.5.

Writing Posts

The first thing that stuck out to me (and that I had been waiting for) was the tag suggest feature. Simply start typing a tag, and an auto-suggest feature will give you a dropdown of existing tags to choose from. Before, it was too easy to end up with tags like “web development” and “webdevelopment” since you had to remember them (no one actually looks them up).
Wordpress 2.5 tags

This brings me to the new way media is managed/added. I haven’t had the need to add videos or sounds to my site, so I’ll stick to the images. In the end, I like the new way it works. The Flash uploader is nice, and the addition of a medium option for each image (thumbnail, medium, full size) is a welcome change. However, nice as it is, there is one thing about it that is REALLY annoying. Full size isn’t actually full size. It’s 500px wide! What’s the point of calling it “full size” and then not making it “full size!” If they want small, medium, and large, they should call it that (although I still think there should be a full size option). There is however a simple solution. You can set $content_width inside your theme’s functions.php file, and it will use that instead of 500 for the max width. I set mine to 1024:

<?php $content_width = 1024; ?>

Unfortunately, this isn’t a standard that was in place, so themes do not have this. It’s a hack, and it’s shouldn’t be needed.

The last thing I wanted to mention, which is very minor, but annoyed me, is that you can’t resize the editor window when in HTML mode. I almost always use HTML mode, and I thought they had removed the ability to resize the text area. as it turns out, you need to switch to the visual editor, resize it, and switch back.

Admin Layout

I don’t like static width layouts. Have dual screens that both run at 1680×1050, and I run my browser full-screen because that’s the way I like it. My laptop runs at 1920×1200, and I even run full-screen on that. Instead of having more room to work, I am rewarded with more than 40% of my screen wasted as blank white space. Having said this, I’ve seen far worse layouts, and it’s fairly intuitive. You can expect plenty of plugins to fix this. Right now (as I’m typing this), what I have done is use firebug to inspect the HTML, found div#wrap, and altered the style by removing max-width:980px;. This seems to work fine for me.

Plugin API

For me, this is the most exciting change. I love the new shortCodes. They are a little rough around the edges, but they are extremely handy. As a matter of fact, I just finished a Google Maps Plugin that uses the shortCodes. It generates a shortCode based on the settings a user chooses, and insert it into the editor. It later handles those shortCodes by changing them out for a Google Map. Unfortunately it relies on the ticket referenced above, so I’ll release it once that gets figured out.

Summary

WordPress 2.5 is definitely a big step forward. It has some small inconsistencies, which I expect to be easily fixed in upcoming minor releases, but nothing that should keep you from upgrading. Go try it and tell me what you think.

Free Template: Minimalist

MinimalistMinimalist is an extremely light weight, configurable template, with no images at all! It’s completely fluid, so no matter what the user’s screen width, you don’t waste any space, browser font resizing is completely supported, and it is source-ordered. It includes stylesheets to display main content on the left or right, as well as many alternative colors including grey, green, blue, purple, red, and brown! It validates as XHTML Strict 1.0, and is released as Public Domain. It is available for download over at OpenDesigns.org.

I just converted Minimalist to a WordPress theme, and uploaded it here for anyone that wants it. I was lazy, so it defaults to green/grey with content to the left. If you want to use a different combination, edit the header.php file to use whatever css files you want (all are included). I also included a contact page template, but again was a little lazy, so you will need to edit contact.php and put your contact info on lines 73-75, as well as your E-Mail address on line 17. The only other real changes that were made was styling for comments (as well as unique styling for admin comments), and I added a pencil icon to use for “editing” (it’s still image free for your users).

WordPress Script Handling

WordPress has some great stuff for handling scripts. You can use wp_enqueue_script() or wp_register_script() to handle scripts. Since there are some scripts that I use so regularly, I decided to automate the process a little more. Basically, I create a js directory inside my template directory, and place the JavaScript files I plan to use there. Each can have certain keywords in the comments at the top of the file to set it’s handle, version, dependencies, as well as whether to enqueue it automatically. The comments may look something like:

/*
Handle: xavisys
Version: 0.1
Deps: scriptaculous-effects
Enqueue: true
*/

/*
Version: 1.5.4.1
Handle: validation
Deps: scriptaculous-effects
*/

/*
Handle: x_contact
Version: 0.1
Deps: validation
*/

Basically, if enqueue is set to true, it will automatically load the file. Otherwise, it will just register it, so that you can use the handle to enqueue it when needed. All you need to do is add the following code to your functions.php file:
Read more

WordPress Mark Parent Pages Plugin

Update: This plugin is not needed in 2.5, it has been included in the WordPress core.

This plugin uses DOM to add a class (current_page_ancestor) to the li tag of each page that is an ancestor of the current one. With a little CSS, you can have nice collapsing menus. This code assumes that your pages are listed using the usual wp_list_pages function, and that they are in an element with the id of nav.

#nav ul li.current_page_item ul,
#nav ul li.current_page_ancestor ul {
    display:block;
}
#nav ul li.current_page_item ul ul {
    display:none;
}

I wanted collapsing menus in WordPress, not Javascript based, but something that would display only top level pages AND pages that are either children of the current page or children of the ancestors of the current page. It may sound confusing, but it’s really quite logical. Take a look:
Read more

WordPress Should Update get_sidebar to Work With Multiple Sidebars

I submitted an enhancement to wordpress yesterday, to allow get_sidebar to work with multiple sidebars. It’s an extremely simple fix, and you end up with a function that looks like this:

function get_sidebar($name=null) {
	do_action( 'get_sidebar' );
	if ( isset($name) && file_exists( TEMPLATEPATH . "/sidebar-{$name}.php") )
		load_template( TEMPLATEPATH . "/sidebar-{$name}.php");
	elseif ( file_exists( TEMPLATEPATH . '/sidebar.php') )
		load_template( TEMPLATEPATH . '/sidebar.php');
	else
		load_template( ABSPATH . 'wp-content/themes/default/sidebar.php');
}

By adding two lines and one optional parameter to the get_sidebar() function, you would be able to pass it a sidebar name. For example, get_sidebar(‘left’) would load the template TEMPLATEPATH . ‘sidebar-left.php’ allowing you to have multiple sidebar files as part of your template.
Read more