function widget($args, $instance) { global $wp_query, $post; // if (is_home() || is_single()) { $this_permalink = get_permalink(); $temp_query = $wp_query->is_single; $wp_query->is_single = true; $prev_comic = get_previous_comic_permalink(); $next_comic = get_next_comic_permalink(); $wp_query->is_single = $temp_query; $temp_query = null; $first_comic = get_first_comic_permalink(); $last_comic = get_last_comic_permalink(); $prev_story = get_previous_storyline_start_permalink(); $next_story = get_next_storyline_start_permalink(); $latest_comic = get_permalink(get_terminal_post_in_category(get_all_comic_categories_as_cat_string(), false)); ?> <div id="comic_navi_wrapper"> <div class="comic_navi"> <span class="comic_navi_left"> <?php if ($instance['first'] == 'on') { if (!empty($first_comic) && $first_comic != $this_permalink) { ?> <a href="<?php echo $first_comic; ?> " class="navi navi-first" title="<?php echo $instance['first_title']; ?> "><?php echo $instance['first_title']; ?> </a> <?php } else { ?> <div class="navi navi-first navi-void"><?php echo $instance['first_title']; ?> </div> <?php } } if ($instance['story_prev'] == 'on') { if (!empty($prev_story)) { ?> <a href="<?php echo $prev_story; ?> " class="navi navi-prevchap" title="<?php echo $instance['story_prev_title']; ?> "><?php echo $instance['story_prev_title']; ?> </a> <?php } else { ?> <div class="navi navi-prevchap navi-void"><?php echo $instance['story_prev_title']; ?> </div> <?php } } if ($instance['previous'] == 'on') { if (!empty($prev_comic)) { ?> <a href="<?php echo $prev_comic; ?> " class="navi navi-prev" title="<?php echo $instance['previous_title']; ?> "><?php echo $instance['previous_title']; ?> </a> <?php } else { ?> <div class="navi navi-prev navi-void"><?php echo $instance['previous_title']; ?> </div> <?php } } ?> </span> <span class="comic_navi_center"> <?php if ($instance['archives'] == 'on' && !empty($instance['archive_path'])) { ?> <a href="<?php echo $instance['archive_path']; ?> " class="navi navi-archives navi-archive" title="<?php echo $instance['archives_title']; ?> "><?php echo $instance['archives_title']; ?> </a> <?php } if ($instance['random'] == 'on') { ?> <a href="<?php echo bloginfo('url'); ?> /?randomcomic" class="navi navi-random" title="<?php echo $instance['random_title']; ?> "><?php echo $instance['random_title']; ?> </a> <?php } if ($instance['comictitle'] == 'on') { ?> <span class="navi-comictitle"><a href="<?php the_permalink(); ?> ">"<?php the_title(); ?> "</a></span> <?php } if ($instance['comments'] == 'on') { ?> <a href="<?php the_permalink(); ?> #comment" class="navi navi-comments" title="<?php echo $instance['comments_title']; ?> "><span class="navi-comments-count"><?php comments_number('0', '1', '%'); ?> </span><?php echo $instance['comments_title']; ?> </a> <?php } if ($instance['buyprint'] == 'on') { ?> <form method="post" title="<?php echo $instance['buyprint_title']; ?> " action="<?php global $buy_print_url; echo $buy_print_url; ?> " class="navi-buyprint-form"> <input type="hidden" name="comic" value="<?php echo get_the_ID(); ?> " /> <button class="navi navi-buyprint" type="submit" value="buyprint"><?php echo $instance['buyprint_title']; ?> </button> </form> <?php } ?> </span> <span class="comic_navi_right"> <?php if ($instance['next'] == 'on') { if (!empty($next_comic)) { if ($next_comic == $latest_comic && $instance['lastgohome'] == 'on') { ?> <a href="/" class="navi navi-next" title="<?php echo $instance['next_title']; ?> "><?php echo $instance['next_title']; ?> </a> <?php } else { ?> <a href="<?php echo $next_comic; ?> " class="navi navi-next" title="<?php echo $instance['next_title']; ?> "><?php echo $instance['next_title']; ?> </a> <?php } ?> <?php } else { ?> <div class="navi navi-next navi-void"><?php echo $instance['next_title']; ?> </div> <?php } } if ($instance['story_next'] == 'on') { if (!empty($next_story) && !is_home()) { ?> <a href="<?php echo $next_story; ?> " class="navi navi-nextchap" title="<?php echo $instance['story_next_title']; ?> "><?php echo $instance['story_next_title']; ?> </a> <?php } else { ?> <div class="navi navi-nextchap navi-void"><?php echo $instance['story_next_title']; ?> </div> <?php } } if ($instance['last'] == 'on') { if (!empty($last_comic) && $last_comic != $this_permalink) { if ($instance['lastgohome'] == 'on') { ?> <a href="/" class="navi navi-last" title="<?php echo $instance['last_title']; ?> "><?php echo $instance['last_title']; ?> </a> <?php } else { ?> <a href="<?php echo $last_comic; ?> " class="navi navi-last" title="<?php echo $instance['last_title']; ?> "><?php echo $instance['last_title']; ?> </a> <?php } ?> <?php } else { ?> <div class="navi navi-last navi-void"><?php echo $instance['last_title']; ?> </div> <?php } } ?> </span> </div> </div> <?php // } }
function comicpress_display_comic_navigation($is_comic = false) { global $post, $wp_query, $comicpress_options; if (!$comicpress_options['disable_default_comic_nav'] && $is_comic) { $first_comic = get_first_comic_permalink(); $last_comic = get_last_comic_permalink(); $wp_query->is_single = true; if (!is_search() && !is_archive() && !is_page()) { ?> <div class="nav"> <?php if (get_permalink() != $first_comic) { ?> <div class="nav-first"><a href="<?php echo $first_comic; ?> "><?php _e('‹‹ First', 'comicpress'); ?> </a></div><?php } ?> <div class="nav-previous"><?php $temp_query = $wp_query->is_single; $wp_query->is_single = true; previous_comic_link('%link', __('‹ Previous', 'comicpress')); $wp_query->is_single = $temp_query; $temp_query = null; ?> </div> <div class="nav-next"><?php next_comic_link('%link', __('Next ›', 'comicpress')); ?> </div> <?php if (get_permalink() != $last_comic) { ?> <div class="nav-last"><a href="<?php echo $last_comic; ?> "><?php _e('Last ››', 'comicpress'); ?> </a></div><?php } ?> </div> <br class="clear-margins" /> <?php } } }