comicpress_display_post();
    }
}
?>

<div <?php 
post_class();
?>
>
	<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) {
Пример #2
0
/**
 * 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 .= '<li class="categories storyline">';
    }
    if ($title_li && $style == "list") {
        $output .= $title_li;
    }
    if ($style == "list") {
        $output .= "<ul>";
    }
    $current_depth = 0;
    foreach ($category_tree as $node) {
        $parts = explode("/", $node);
        $category_id = end($parts);
        $target_depth = count($parts) - 2;
        if ($target_depth > $current_depth) {
            $output .= str_repeat("<li><ul>", $target_depth - $current_depth);
        }
        if ($target_depth < $current_depth) {
            $output .= str_repeat("</ul></li>", $current_depth - $target_depth);
        }
        $output .= '<li><a href="' . get_category_link($category_id) . '">';
        $output .= $categories_by_id[$category_id]->cat_name;
        $output .= "</a></li>";
        $current_depth = $target_depth;
    }
    if ($current_depth > 0) {
        $output .= str_repeat("</ul></li>", $current_depth);
    }
    if ($style == "list") {
        $output .= "</ul></li>";
    }
    echo $output;
}