init(); if (is_dir($addons_dir = (dirname(__FILE__) . '/addons'))) { $entries = glob($addons_dir . '/*'); if (is_array($entries)) { foreach ($entries as $entry) { if (is_dir($entry)) { $classname = basename($entry); if (file_exists($entry . "/${classname}.inc")) { require_once($entry . "/${classname}.inc"); $classname = "ComicPressAddon${classname}"; if (class_exists($classname)) { $addon = new $classname(); $addon->init(&$comicpress); if (is_admin()) { add_action('admin_notices', array(&$addon, 'display_messages')); if (is_array($_POST['cp'])) { if (isset($_POST['cp']['_nonce'])) { if (wp_verify_nonce($_POST['cp']['_nonce'], 'comicpress')) { if (method_exists($addon, 'handle_update')) { $addon->handle_update(); } } } } } } } } } } } } function in_comic_category() { global $post, $comicpress; return $comicpress->in_comic_category($post->ID); } /** * Display the list of Storyline categories. */ function comicpress_list_storyline_categories($args = "") { global $category_tree; $defaults = array( 'style' => 'list', 'title_li' => __('Storyline') ); $r = wp_parse_args($args, $defaults); extract($r); $categories_by_id = get_all_category_objects_by_id(); $output = ''; if ($style == "list") { $output .= '
  • '; } if ($title_li && ($style == "list")) { $output .= $title_li; } if ($style == "list") { $output .= "
  • ", $current_depth); } if ($style == "list") { $output .= ""; } echo $output; } /** * Display text when image (comic) is hovered * Text is taken from a custom field named "hovertext" */ function the_hovertext() { echo get_the_hovertext(); } function get_the_hovertext() { $hovertext = get_post_meta(get_the_ID(), "hovertext", true ); return (empty($hovertext)) ? get_the_title() : $hovertext; } /** * Display the comic transcript * Transcript must be entered into a custom field named "transcript" * @param string $displaymode, "raw" (straight from the field), "br" (includes html line breaks), "styled" (fully css styled with JavaScript expander) */ function the_transcript($displaymode = 'raw') { $transcript = get_post_meta( get_the_ID(), "transcript", true ); switch ($displaymode) { case "raw": echo $transcript; break; case "br": echo nl2br($transcript); break; case "styled": if (!empty($transcript)) { ?>
    ↓ Transcript


    query('showposts=1&orderby=rand&cat='.get_all_comic_categories_as_cat_string()); while ($randomComicQuery->have_posts()) : $randomComicQuery->the_post(); $random_comic_id = get_the_ID(); endwhile; wp_redirect( get_permalink( $random_comic_id ) ); exit; } if ( isset( $_GET['randomcomic'] ) ) add_action( 'template_redirect', 'random_comic' ); // Register Sidebar and Define Widgets if ( function_exists('register_sidebar') ) register_sidebar(); function widget_comicpress_latest_comics() { ?>
  • Latest Comics

  • ? Random Comic