<div class="post-head"></div>
	<div class="post-content">
		<ul id="storyline" class="level-0">
<?php 
if (get_option('comicpress-enable-storyline-support') == 1) {
    if (($result = get_option("comicpress-storyline-category-order")) !== false) {
        $categories_by_id = get_all_category_objects_by_id();
        $current_depth = 0;
        $storyline_root = " class=\"storyline-root\"";
        foreach (explode(",", $result) as $node) {
            $parts = explode("/", $node);
            $target_depth = count($parts) - 2;
            $category_id = end($parts);
            $category = $categories_by_id[$category_id];
            $description = $category->description;
            $first_comic_in_category = get_terminal_post_in_category($category_id, true);
            $first_comic_permalink = get_permalink($first_comic_in_category->ID);
            if ($target_depth < $current_depth) {
                echo str_repeat("</ul></li>", $current_depth - $target_depth);
            }
            if ($target_depth > $current_depth) {
                for ($i = $current_depth; $i < $target_depth; ++$i) {
                    $next_i = $i + 1;
                    echo "<li><ul class=\"level-{$next_i}\">";
                }
            }
            ?>
						
						<li id="storyline-<?php 
            echo $category->category_nicename;
            ?>
    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 
        // }
    }
<?php

/*
Template Name: Comic Year Archive
*/
get_header();
remove_filter('pre_get_posts', 'comicpress_members_filter');
include get_template_directory() . '/layout-head.php';
?>

<?php 
if (isset($_REQUEST['archive_year'])) {
    $archive_year = $_REQUEST['archive_year'];
} else {
    $latest_comic = get_terminal_post_in_category(get_all_comic_categories_as_cat_string(), true);
    $archive_year = get_post_time('Y', false, $latest_comic, true);
}
if (empty($archive_year) || $archive_year == '') {
    $archive_year = date('Y');
}
?>
 
	
<?php 
if (have_posts()) {
    while (have_posts()) {
        the_post();
        comicpress_display_post();
    }
}
?>
Ejemplo n.º 4
0
function latest_comic_jump()
{
    wp_redirect(get_permalink(get_terminal_post_in_category(get_all_comic_categories_as_cat_string(), false)));
    exit;
}