[[innerindex]]While creating the Uber-Geeks Web Comic, I wanted to keep WordPress as the backend for all my comic posting needs…which was fine. In doing so, I lacked the appropriate browsing features that seem common amongst many web comics (like Penny Arcade and RealLife).
This plugin places a comic browser in a comic post (along with the comic name) providing navigation to First, Previous, Next, and Last comics.
- Download and unzip mycomic.zip
- Place mycomic.php in your wp-content/plugins directory
- Log in to your WordPress admin panel and activate the plugin, then visit the new mycomic submenu of the plugins tab. This will allow mycomic to create its database tables.
- Once installed, be sure to enable the options and consider customizing the look by adding the mycomic CSS to your theme’s CSS.
- Edit Your Post/Page Tempates
Editing Your Post & Page Templates
Place the following line of code above the output of the content of a post/page:
< ?php if($comic=mycomic_is_comic($id)) mycomic_navigator($comic,$id); ?>
Here’s what the Uber-Geeks index.php looks like (line 14 has the code you want to insert):
< ?php get_header(); ?> <div id="content" class="narrowcolumn"> < ?php if (have_posts()) : ?> < ?php while (have_posts()) : the_post(); ?> <div class="post top" id="post-<?php the_ID(); ?>"> <h2 class="first"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to < ?php the_title(); ?>">< ?php the_title(); ?></a></h2> <div class="postmetadata">Posted in < ?php the_category(', ') ?> by < ?php the_author() ?> | < ?php edit_post_link('Edit', '', ' | '); ?> < ?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></div> <div class="entry"> < ?php if($comic=mycomic_is_comic($id)) mycomic_navigator($comic,$id); ?> < ?php the_content("<span class=\"continue\">" . __('Continue reading','') . " '" . the_title('', '', false) . "'"); ?> </div> </div> < ?php endwhile; ?> < ?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> < ?php include (TEMPLATEPATH . "/searchform.php"); ?> < ?php endif; ?> </div> < ?php get_sidebar(); ?> < ?php get_footer(); ?>
Place that line of code in similar fashion in any template file that you wish to display the MyComic Browser.
Adding A Comic
Once fully installed, you are free to mark your comic posts as comics (in order to add them to the comic browser table). While editing/adding a post, simply create a custom field:
- Key: comic
- Value: 1
Save your post and the browser will appear!