by
jrrl in
Templature :: posted January 13, 2010 :: last modified February 5, 2010
If you are a programmer or a web developer, you deal with code. It is part and parcel of the job. And a time may come when you want to share some of it with your readers by putting it in a post. Perhaps your are showing a social ranking algorithm written in Python. Maybe you are demonstrating an HTML idiom. You could even be writing something as unusual as a PHP or WordPress tutorial! In any one of these cases, you want an easy way to display the code.
Of course, there is one very simple way. Just paste it into the visual editor (not the HTML editor) and it will do any necessary conversion of angle brackets, ampersands, etc. into HTML entities. If WordPress thinks it is HTML code, it will even wrap it in pre tags for you. Observe:
<div id="search">
<form id="searchform" method="GET" action="/index.php">
<input type="text" name="s" id="s" size="16" class="inputtext" />
<input type="submit" value="Search" class="button" />
</form>
</div>
[read more]
by
jrrl in
Templature :: posted January 12, 2010 :: last modified February 5, 2010
You know how some books have little quasi-relevant quotes at the start of each chapter? They are called chapter quotes and then can be a nice addition to some posts. Let’s see how we can do this easily in WordPress.
Of course, we could just toss the quote and relevant markup in the top of our post body. This would work, but is not the best method. The biggest problem is that the quote will appear on any page that includes an excerpt from our post. This means it will might there on the home page, the category page, the archive page, the tag pages, search results, and even in your RSS feeds! No matter how cool or appropriate the quote is, we would probably rather show off a bit of our text instead, no?
[read more]
It is a new year and I hope to make it a better one. With that in mind, here are a few of the things I hope to accomplish in 2010. Not all are directly relevant to web development, but so be it.
- Post More Often
Look! The least original resolution in the age of blogging! Even so. There are many times I think of something that would make a good post and never get around to writing it. Sometimes other things come up. Other times, someone else has written something similar and I don’t want to be redundant. But much of the time, I get distracted and either forget the idea entirely or wait too long and the moment passes.
Not every post has to be a winner and certainly most of mine are not, but as the misquotation goes “Let a thousand flowers bloom.” If I put more of my ideas into writing and write more often, several things should happen. First, the occasional winning idea is more likely to make it past my fingertips and onto this or another site. Second, my writing muscles should become more limber. Writing begets writing and makes each successive piece easier to put into words. Third, I hope this will help me find more of a voice on this site. This has long been a problem for me. I am not a particularly formal person. In fact, I am probably a bit too casual. Unfortunately, whether from spending too long in academia and then too long in corporate land, or from spending too little time practicing the craft of writing in recent years, I find that my writing can be formal to the point of stiffness. I would prefer that whatever personality I may possess show through a bit and perhaps help me express my ideas more clearly. Of course, none of that has happened here, but one can hope.
[read more]
by
jrrl in
Templature :: posted December 7, 2009 :: last modified February 5, 2010
WordPress 2.9 isn’t quite out yet, although it looks like it might make it before the end of the year. Even so, many of us are playing with the betas and seeing what the new features can do. One of the features that usually gets a mention but little else is custom post types.
Post types are not new in 2.9. The post table in WordPress has had a post_type field since 2.0 which was released way back in 2005. Posts and pages are the same thing internally, but have a different value in the post_type field. This affects how they are treated by loop queries, so you don’t get pages on your archive and category pages, etc. In addition the post_type field can mark an object as a revision or an attachment.
So, today there are only four recognized values for post_type: post, page, revision, and attachment. There is no reason you couldn’t use other values, and some plugins may, but the core WordPress code will ignore those entries.
[read more]
Leave a comment