diff --git a/classes/ComicPress.inc b/classes/ComicPress.inc index 2924122..2402214 100644 --- a/classes/ComicPress.inc +++ b/classes/ComicPress.inc @@ -174,14 +174,17 @@ class ComicPress { } function get_nav_comics() { + global $post; + $comic_posts = array(); foreach (array('first', 'last', 'previous', 'next') as $which) { $comic_posts[$which] = $this->{"get_${which}_comic"}(); } - $comic_posts['show_first'] = ($comic_posts['first']->ID !== $comic_posts['last']->ID); - $comic_posts['show_previous'] = (!empty($comic_posts['previous']) && ($comic_posts['first']->ID !== $comic_posts['previous']->ID)); - $comic_posts['show_next'] = (!empty($comic_posts['next']) && ($comic_posts['last']->ID !== $comic_posts['next']->ID)); + $comic_posts['show_first'] = ($comic_posts['first']->ID != $comic_posts['last']->ID); + $comic_posts['show_previous'] = (!empty($comic_posts['previous']) && ($comic_posts['first']->ID != $comic_posts['previous']->ID)); + $comic_posts['show_next'] = (!empty($comic_posts['next']) && ($comic_posts['last']->ID != $comic_posts['next']->ID)); + $comic_posts['show_last'] = (trim($post->ID) != trim($comic_posts['last']->ID)); return $comic_posts; } diff --git a/functions.php b/functions.php index 8f02af9..bbfa060 100644 --- a/functions.php +++ b/functions.php @@ -75,61 +75,12 @@ function __comicpress_init() { } } } - - //get_all_comic_categories(); } -function the_comic_img_tag($url, $type, $additional_parameters = array()) { - global $comicpress; +function in_comic_category() { + global $post, $comicpress; - echo $comicpress->get_comic_img_tag($url, $type, $additional_parameters); -} - -/** -* Get the hyperlink to the first comic post in the database. -* @return string The hyperlink to the first comic post, or false. -*/ -function get_first_comic_permalink() { - global $comicpress; - - $terminal = $comicpress->get_first_comic(); - return !empty($terminal) ? get_permalink($terminal->ID) : false; -} - -/** -* Get the hyperlink to the last comic post in the database. -* @return string The hyperlink to the first comic post, or false. -*/ -function get_last_comic_permalink() { - global $comicpress; - - $terminal = $comicpress->get_last_comic(); - return !empty($terminal) ? get_permalink($terminal->ID) : false; -} - -/** - * Get the link to the previous comic from the current one. - */ -function previous_comic_link($format, $link) { - global $non_comic_categories; - previous_post_link($format, $link, false, $non_comic_categories); -} - -/** - * Get the link to the next comic from the current one. - */ -function next_comic_link($format, $link) { - global $non_comic_categories; - next_post_link($format, $link, false, $non_comic_categories); -} - -/** - * Get the adjacent comic from the current one. - * @param int $category The category to use. - * @param boolean $next True if the next chronological comic should be retrieved. - * @return array The WordPress post object for the comic post. - */ -function get_adjacent_comic($category, $next = false) { + return $comicpress->in_comic_category($post->ID); } /** diff --git a/header.php b/header.php index ccd20cf..c6666a7 100644 --- a/header.php +++ b/header.php @@ -42,6 +42,4 @@
- - \ No newline at end of file diff --git a/index.php b/index.php index 24e3ed2..ccc4906 100644 --- a/index.php +++ b/index.php @@ -2,6 +2,9 @@ global $comicpress; get_header(); + + $nav_comics = $comicpress->get_nav_comics(); + $post = $nav_comics['last']; ?> @@ -12,28 +15,10 @@
-get_nav_comics(); - - $post = $nav_comics['last']; - - ?> +
- +
diff --git a/single.php b/single.php index ab86a20..f2fdaa4 100644 --- a/single.php +++ b/single.php @@ -1,73 +1,74 @@ - + -
-
- <?php the_title() ?> -
-
- + get_header(); + + if (have_posts()) { + the_post(); + if (in_comic_category()) { ?> +
+
+
+ get_nav_comics(); +?>
- - - - -
-
-
- - -
- -
  • ', 'multiple') ?>
- -

-
- - -
- -
- '

Pages: ', 'after' => '

', 'next_or_number' => 'number')) ?> -
-
-
-
- - - -
-
- -
-

- -
- - -
- -
- '

Pages: ', 'after' => '

', 'next_or_number' => 'number')) ?> -
-
-
-
- - + + + +
+
+
+ + +
+ +
  • ', 'multiple') ?>
+ +

+
+ + +
+ +
+ '

Pages: ', 'after' => '

', 'next_or_number' => 'number')) ?> +
+
+
+
+ +
+
+ +
+

+ +
+ + +
+ +
+ '

Pages: ', 'after' => '

', 'next_or_number' => 'number')) ?> +
+
+
+
+ + - - - + + +
@@ -76,7 +77,7 @@
- +