The days nemesis has been vanquished!

This might seem a bit lame to those who actually know what they’re doing, but I have been bashing my head against the wall trying to figure out how to grab and display more than one post in a category using the archive.php file.

I’m using the archive.php file instead of creating a specific category file because I want to keep the layout the same with the least amount of editing whenever I do need to make a change. Copy pasta maybe easy, but it soon gets tiresome and is needless extra hassle.

After some frantic “help!” posts on twitter (thank you @wpbeginner for responding!) and friendfeed plus a little searching of my own, all roads seemed to lead to this page in the wordpress codex.

Specifically, this solution:

<?php

$categoryvariable=$cat; // assign the variable as current category

$query= ‘cat=’ . $categoryvariable. ‘&orderby=date&order=ASC’; //concatenate the query

query_posts($query); //run the query

?>

Now, dumping this just before the while (have_posts()) : the_post(); line, ensuring you swap out ($query) with (’showposts=10&cat=’.$cat) will give you what you want – upto 10 posts of the category selected by the user.

Sadly, this will break the displaying of your tags, which simply won’t do! Off to the drawing board again!

My starter for ten was to try creating my More >

Hmmm…

Well, last night I suffered the C:\ on my main rig corrupting, guess that explains why the system had gone a little wobbly before I tried to reboot it.

This means I’m spending the day on my macbook while I have the HDD connected to my server for a little data recovery using Arax Disk Doctor, which has saved my arse a few times now (at a reasonable price too! No, I don’t work for them nor do I get any kickbacks!).

So, everything I was working on needed to migrate to there which means I discovered something… the text editor that comes with OSX sucks balls. Seriously, it totally screwed up the html/php I was working on causing the development site for Vertical Slice that I was playing with to break and not load. So, off I went hunting for a real editor.

I finally discovered a free one (since there are so many simple apps that people are trying to charge $70 and upwards for on OSX, definitely a better ecosystem on windows and linux). The editor I eventually decided upon is called Smultron. Well worth grabbing a copy if you want to edit html/php on your mac without More >