Category: Development

Custom Field Hacks For WordPress

Custom fields are a great little thing. They allow you to easily customize your blog with only a little bit of code. Below is a succinct explanation on how to do it, courtesy wprecipes.com

Open your single.php file (You can also modify your index.php file) and paste the following code anywhere within the loop:

$customField = get_post_custom_values("mood");
if (isset($customField[0])) {
echo "Mood: ".$customField[0];

Save the file. Now when you’ll write a new post, just create a custom field named mood and type your current mood as a value.

WordPress Popularity

I recently read an article over on writerspace.net, entitled WordPress.com Nearing Popularity Landmark The article speaks to a simple numbers game relative to wordpress’ popularity on the web. Fascinating enough, it is predicted that wordpress will top 10 million blogs by the end of the year.

As a developer, I would just like to add a few more reasons why wordpress is the dominating force in the blogosphere.

Pings and track backs

From wikipedia:

Track backs are used primarily to facilitate communication between blogs; if a blogger writes a new entry commenting on, or referring to, an entry found at another blog, and both blogging tools support the TrackBack protocol, then the commenting blogger can notify the other blog with a “TrackBack ping“; the receiving blog will typically display summaries of, and links to, all the commenting entries below the original entry. This allows for conversations spanning several blogs that readers can easily follow.

Compared to other blogging software out there, wordpress is the superior product to handle ping and trackbacks. Superior to expression engine, blogger and movable type. Why are ping and track backs so important? Exposure. the TrackBack protocol, as simple as it is, helps to give your article the depth and breath that it would not normally see if it were up to you or your community to forward on your blog topic.

Development Community

With wordpress leading the charge in the blogosphere as the number one platform to publish blogs, the development community has come with them. Need a plugin to manage your ads? Need a plugin to increase your SEO? Need a plugin to create sitemaps? All those are accomplished with a few clicks and a download. With such a large userbase and supporting development community, chances are that someone out there has had the same need as you and there is a solution available.

All this is not to say that the alternative platforms are not wonderful engines to create your blog, not by any means. However, if asked, I personally would reccomend using wordpress.

jQuery Plugin: Cycle

At this point, jQuery is nothing new in the web development world. AJAX has taken the community by storm, and I can’t stop shouting from the highest mountain tops, the benefits of an AJAX supported website. Asynchronous javascript is a foundation of web 2.0, and a big part of my development cycle.

The ability to create dynamic portions of a website is crucial in providing an end user experience that is second to none. jQuery, and the like (mootools, rico, scriptaculous), makes it all the more simpler.

One powerful subset of a jQuery founded website are plug-ins. Simple pieces of open source code, developed by the community, that ease development time 100 fold. Case in point: the cycle plug-in.

The cycle plug-in is used to create slideshows of all kinds. A tutorial for how to do this can be found here, so I will refrain from recreating it. Follow the easy to navigate instruction set, and within 20 minutes, you can create a basic slideshow. Within 30 minutes and a much more dynamic and custom slideshow can also be created.

I will concede however, that there is such a thing as too much asynchronous activity. I prefer to look at a project and ask myself two questions: will this enhance the end user’s experience or will it get in the way and be a distraction? and the second: Do I really need to use jQuery for this?

For Attribute Used With Label Tags

There are times that I feel like I am on the cutting edge of development. Web 2.0 and AJAX trickery gives me that feeling all the time. Then there are times where I ask myself, “Why didn’t I know about this before?” That’s how I feel about the for attribute for the <label> tag.

I found this little gem a few weeks ago, and after my collegues stopped laughing at me, I was told that this was nothing new. The for attribute has been around for a while, and is a helpful bit of HTML.

Found inside of a <label>, and next to an <input>, the for attribute can provide an end user a little bit more functionality from your form.

<label for=”radioName”>Label name</label><input type=”radio” name=”radioName” />

where the for attribute is the same as the id attribute for the corresponding <input>

With the for attribute used, the user can either click on the radio button itself, or the much larger target, the label text.

Using the for attribute will also help those using speech browsers.

I like these small little bits, espcially in a form with a lot of radio buttons. Having a secondary place for your audience to click might not make the difference on your conversion, but it sure is a nice touch.

A Fight To The Finish

I am currently employed full time as Lead Designer at a shop that is an exclusive vendor (or at least tries to be) of Microsoft products. “If Microsoft can produce it, we’ll buy it.” Personally, .NET is of little interest to me. I prefer to code inside of PHP. I can forsee that I will have certain biases for PHP, I admit that. But what is frustrating for me is all the hate from my co-workers.

Having the title of designer at work makes it hard enough to put up a fight for PHP at work, but when I attempt to add in a few thoughts here and there about a theoretical code procedure, I am shot down; FAST! Forget the fact that .NET is an application framework and PHP is a language. Forget the fact that PHP is open source, and .NET is not. And forget the fact that because of that, its like comparing apples to oranges. The fact of the matter is that PHP is just as viable of a coding language as .NET is a framework.

I wont argue that .NET is a highly flexible framework, building both website and standalone applications. I wont argue that PHP is primarily, if not exclusively, focused on websites. But what I will argue is that PHP is not vastly inferior to .NET because of one reason, pre-compiled code.

.NET pre-compiles its code before it is published out to a live server. PHP is not. For this one simple fact, every .NET developer I work with say that .NET is superior. But why? Why would I want to republish entire sites because of a simple code change? Why would I want to add an additional step to the process, when I can simply add/remove a function, move that page up to the server, and be done with it?

To me, and I might be the naive one here, I prefer the simplicity of this process. Time and time again, I have seen my fellow coworkers wait and wait for a website to compile and be published to a server. Which, might be a small preference in the grand scheme of things, but I just want to be done with it.

So to my co-workers I say Ni!

Ni!

Ni!

Sure you can make other arguments about the dominance of .NET to PHP, and I will listen. With deaf ears I will listen. Phooey on you for thinking that .NET is so much greater of a product than PHP. –With the advent of PHP5, your arguments for superiority grow thin (OOP support hint hint, nudge nudge).

Rest assured that one day, you will be hearing your fellow developers ask “you want this in PHP or .NET? there is really no difference”.

Up