Categories
Uncategorized

Getting started with WordPress 2.5

I’ve a new project at work developing a quick and dirty new website from an old and rather ragged looking original.

I won’t hear of any websites with more than 6 pages having any less than a CMS behind them, so I was tasked with some research. Drupal and Joomla were two other considerations with a large following. Drupal is great but too large, almost too comprehensive for my needs. The templates are a nightmare to customise, and when using plugins it can be hard to keep your plugins in sync with each core Drupal release. Joomla meanwhile I bear a grudge towards since it was Mambo-table-tastic CMS many years ago. I’ve seen it now and it looks a lot different but I remained unconvinced.

WordPress is perhaps not the obvious choice as it’s a bloggers favourite and my site won’t be that regularly updated, but I do have a lot of archives to cut and paste into the new site, and the WordPress Visual Editor is excellent at this monkey work.

I also like the feel of the WordPress system. It’s simple, with just the basics in the database and all the customisation to be done by using various template tags offered. The admin interface takes very little time to familliarise yourself with, the documentation is for the most part well written and up to date, and the community is active making plugins for all the extra tat you might want on top.

Anyway, from my experiments here are some details of things you’ll probably want to know if you’re starting a new WordPress site.

Find out what you’ll be working with

Wikipedia: WordPress as always isn’t a bad start.

Get it on your server

Install, and this one was a doozy (but that whole 5 minute install spiel is a bit bogus). Call it 20 minutes to be safe.

Get a nice template

I was particularly looking for templates which had a magazine feel. Here are some links and favourites for inspiration.

Once you’ve got your theme installed, switched it on in the admin interface, you can start creating categories and your site structure.

Huh, links are all crappy?

Make sure you’ve got your pretty permalinks configured. Oh, and choose your permalink structure. Blogs used to be archived in a date based style 2008/02/21/now_is_my_post_name but now you see many more category based URLs /pets/now_is_my_post_name/ which is /%category%/%postname%/ in WordPress

You don’t want to change this later down the line for obvious reasons. It’s all in admin under Settings -> Permalinks

Hrm, is your template not producing quite what you actually wanted? Start tinkering with your templates.

Know your file structure.

/yourserver/wp/wp-content/themes/yourtheme/

..is where you’ll want to start digging into the templates. Back up a clean copy!

index.php header.php footer.php style.css page.php are all pages you may need to edit.

Know your template tags.

Most important is the concept of The Loop. This is the bit in the template that will spit out your posts. It’ll be everywhere there is content coming out of the database.

Want your front page to only show posts from one category?

..or exclude a few – you’ll need to read about the tag query_posts()

Finding category IDs appears to be a dirty but necessary requirement for customising things. Maybe there is a nicer way to do this but I was in a hurry. You can find out the cat IDs from your Admin interface. Manage -> Categories and mouse over the name and it’ll show a link something like

http://yourserver/wp/wp-admin/categories.php?action=edit&cat;_ID=3

So your category here is 3.

Want the last post from one category in a single place?

It’s query_posts() again with the parameter showposts=1. Easy!

The excerpts are broken?

Another small problem. I found the default “excerpt” (an abbreviation of a post as a leader) shown on the front blog page to be rather limiting. It seemed to strip most of the HTML formatting out, and show no images.

You can of course also create a bespoke excerpt in the editor for each post, and your HTML will be respected in whole, but if you’ve lots of content and little time this may be a pain.

To the rescue is the excellently named Excerpt Reloaded. This gives you much more control of how much and what is seen in the default excerpt.

Flickr Sidebar Widget?

Try the flickRSS. This works with 2.5 but is a bit limited. It has the benefit of local caching but won’t do random pics (maybe I will edit it!). Ok if you update regularly.

Pages versus posts?

Yeah, it’s a bit messy but it does work in a way. Keep pages to static content, posts for blog entries. Navigation wise you are really limited to not mixing these two. Most people will have a short list of static content in one nav area, and the blog entries by date or category somewhere else.

Want to have a category linked to in your “pages” nav bar?

You could hard code it in the template but having the navigation handled by the admin system is neater, and you can add, delete and reorder these links. Hrm, nasty hack here that makes WordPress think it’s serving up a static page but it then redirects to the category page.

Get a sitemap plugin.

This Google friendly XML one will do the job for search engine friendlyness.

Easy peasy podcasting?

Podpress. You might not even want to make proper podcast but you can use this as a convenient way to upload music files and get a flash player built in. Note: the built in uploader won’t do more than 3MB or similar – I just file transfer large uploads into the default /wp-uploads/year/month/ folder instead. You can then reference the link in the editor.

Navigation not respecting where you are on the site?

Might just be my template but there seem to be lots of WordPress clones out there that don’t obey the simple rule that the navigation should show you where you currently are. WordPress call it Dynamic Navigation highlighting (a good page for clarification, but now outdated as many WP templates will use this loop to draw the page navigation)

‘depth=-1&title;_li=’); ?>

..part of that HTML list generated will include a class in the li marking the page the current one, which can easily be styled in the css.

#nav .current_page_item a { background-color: grey; text-decoration: none; }

However, the home page being a special template, and not part of the internal list of static pages, was a hard coded link in my template. No worry, there is a WordPress template tag for everything so I manually added some php to see if we are currently on the home page, and set the correct CSS style if so.

  • if
  • (is_home()) { echo ‘class=”current_page_item”‘;}?>>>Home

    You may have to add this by hand. Or not. All templates vary.

    Here is a great page with useful theme hacks.

    Well, bosh, bosh, bosh and the website was up in a few days. I have much more to learn about WordPress. Caching seems to be sensible, as do some security measures to tighten the install. I have yet to see if the built in comment anti-spam measures will work effectively, but I think for someone wanting a simple site, with lots of flexibility, WordPress is a fun little kit.

    Leave a Reply

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