Using WordPress as a Webcomic Archive

Now that your comics are linked to each and every blog post, it’d be nice to be able to navigate through them. WordPress features a built-in command that will automatically generate images linking to the next and previous posts.

<?php previous_post_index('%', 
	'<img src="http://www.yourURL.com/images/previous_day.gif"
	border="0px"/>', 'no'); ?>
<?php next_post_index('%',
	'<img src="http://www.yourURL.com/images/next_day.gif"
	border="0px"/>', 'no'); ?>

To get the first and last comic navigation buttons, simply hardcode in a link to your first comic and a link to your main page. Simple as that.

That nifty calendar you see in the archives is also a built-in command:

<?php get_calendar(); ?>

And so is the storyline dropdown! Actually, it’s the category dropdown. WordPress lets bloggers label posts under categories they create, but here we use them to navigate to the start of a storyline. To create a new storyline label, I simply add a new category through Manage>Categories in the dashboard, then label only the first comic in the storyline with that category. If I labeled every comic in the storyline with the same category, besides being tedious, the dropdown would only point to the most recent comic instead of the one sequentially first.

<form action="<?php echo $PHP_SELF ?>" method="get">
	<?php dropdown_cats(false); ?>
	<input type="submit" name="submit" value="Go!" />
</form>

To add pages to your site, you can either upload separate html files like always, or build them from within WordPress. In the Dashboard, go to Write>Write Page. Doing this will allow you to use your template (no extra code! Woo!) And makes it that much easier to edit and update. It also makes it easy to get to… rather than linking to breakpointcity.com/links.html, you’ll find your page at breakpointcity.com/links.

Again, the PHP is the tricky part, but if you’re not afraid of learning some new HTML tricks and have the resources to run WordPress, you’re going to love the kind of control it offers. If anyone reading this has any interest in making a web comic WordPress plug-in, please let me know!

Special thanks to all on the Blambot Nexus who helped me out, specifically Jospo and Wallerdm who wrote a Javascript archive that inspired me to code my own. And thanks to Ty from AdGrunts and Jesstech from Dandy and Company for answering my questions and showing me that WordPress and webcomics could, infact, work together. And thanks to Glutnix over at Webfroot who told me about WordPress in the first place!

Pages: 1 2 3 4 5