WordPress 2.5 Shortcodes

Written by aaroncampbell - Posted on April 22, 2008 at 10:36 am

Warning: Shortcodes are affected by Trac ticket 6444, which should be applied to 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. Continue reading this entry…

No Comments

A Great Little Script for Affiliate Marketers

Written by Karen - Posted on April 18, 2008 at 5:10 am

There are, unfortunately, some dishonest people who will either hijack or try to bypass your affiliate links while you work your tail off wondering why you are not getting any sales. I’ve found the best solution to stop that from happening.

There are many services on the net offering shorter links, etc., but to me they don’t seem as professional as this script I found recently called simply Free Link Cloaker. Not only will this script mask your affiliate links, but it uses a friendly keyword format such as http://yourdomain.com/recommends/keyword
Nice!

Another added feature is that the script keeps track of the number of clicks your cloaked link gets, so you will know which affiliate products are converting for you.

It does require a MySQL database and it uses PHP rather than Javascript, making it a much more stable link cloaker than others you may find in your searches. It is easy to set up, taking only minutes, but you can get support if needed and upgrades for life. I find this little script to be an invaluable resource for every affiliate marketer, or for anyone who just wants shorter URLs.

1 Comment

WordPress 2.5: First Impressions

Written by aaroncampbell - Posted on April 15, 2008 at 10:08 pm

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:

$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 inserts 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.

1 Comment