53 lines
1.9 KiB
PHP
53 lines
1.9 KiB
PHP
<?php
|
|
$nav_fields = array(
|
|
'first' => '‹‹ ' . __('First', 'comicpress'),
|
|
'previous' => '‹ ' . __('Previous', 'comicpress'),
|
|
'next' => __('Next', 'comicpress') . ' ›',
|
|
'last' => __('Last', 'comicpress') . ' ››'
|
|
);
|
|
|
|
if ($comicpress->needs_storyline_nav()) {
|
|
$nav_fields = array_merge(
|
|
array('prior' => '‹‹ ' . __('Prior Storyline', 'comicpress')),
|
|
$nav_fields,
|
|
array('upcoming' => __('Upcoming Storyline', 'comicpress') . ' ››')
|
|
);
|
|
|
|
foreach ($comicpress->get_sorted_post_categories() as $category_id) {
|
|
$prev_next_categories = $comicpress->get_previous_next_categories($category_id);
|
|
|
|
foreach ($prev_next_categories as $master_id => $cat_list) {
|
|
foreach ($cat_list as $which => $id) {
|
|
switch ($which) {
|
|
case "previous":
|
|
$terminal_post = $comicpress->get_last_comic($id);
|
|
$which_field = "prior";
|
|
break;
|
|
case "next":
|
|
$terminal_post = $comicpress->get_first_comic($id);
|
|
$which_field = "upcoming";
|
|
break;
|
|
}
|
|
|
|
if (is_object($terminal_post)) {
|
|
$nav_comics[$which_field] = $terminal_post;
|
|
$nav_comics["show_${which_field}"] =true;
|
|
}
|
|
|
|
if (count($terminal_post) == 2) { break; }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
<div class="nav">
|
|
<?php foreach ($nav_fields as $field => $link_text) { ?>
|
|
<?php if ($nav_comics['show_' . $field]) { ?>
|
|
<div class="nav-<?php echo $field ?>">
|
|
<a href="<?php echo (is_object($nav_comics[$field])) ? get_permalink($nav_comics[$field]->ID) : $nav_comics[$field] ?>"
|
|
title="<?php sprintf(__('Go to the %s comic', 'comicpress'), $field) ?>"><?php echo $link_text ?></a>
|
|
</div>
|
|
<?php } ?>
|
|
<?php } ?>
|
|
</div>
|