Beispiel #1
0
function ceo_archive_list_by_all_years($thumbnail = false, $order = 'ASC', $chapter = 0)
{
    global $wpdb;
    $latest_comic = ceo_get_last_comic(false);
    $archive_year_latest = get_post_time('Y', false, $latest_comic, true);
    $first_comic = ceo_get_first_comic(false);
    $archive_year_first = get_post_time('Y', false, $first_comic, true);
    if ($chapter) {
        $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM {$wpdb->posts} LEFT JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id) LEFT JOIN {$wpdb->term_taxonomy} ON ({$wpdb->term_relationships}.term_taxonomy_id = {$wpdb->term_taxonomy}.term_taxonomy_id) WHERE {$wpdb->posts}.post_status = 'publish' AND {$wpdb->term_taxonomy}.taxonomy = 'chapters' AND {$wpdb->term_taxonomy}.term_id = " . $chapter . " ORDER BY post_date " . $order);
    } else {
        $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM {$wpdb->posts} WHERE post_status = 'publish' AND post_type='comic' ORDER BY post_date " . $order);
    }
    $output = '';
    foreach ($years as $year) {
        if ($chapter) {
            $comic_args = array('showposts' => -1, 'year' => (int) $year, 'post_type' => 'comic', 'chapter' => $chapter, 'order' => $order);
        } else {
            $comic_args = array('showposts' => -1, 'year' => (int) $year, 'post_type' => 'comic', 'order' => $order);
        }
        $theposts = get_posts($comic_args);
        $output .= '<h3 class="year-title">' . $year . '</h3>';
        $output .= '<table class="month-table">';
        foreach ($theposts as $post) {
            $output .= '<tr><td class="archive-date">' . get_the_time('M j', $post->ID) . '</td><td class="archive-title"><a href="' . get_permalink($post->ID) . '" rel="bookmark" title="' . get_the_title($post->ID) . '">' . get_the_title($post->ID) . '</a></td></tr>';
        }
        $output .= '</table>';
    }
    return $output;
}
Beispiel #2
0
function ceo_get_first_comic_in_chapter_permalink()
{
    $terminal = ceo_get_first_comic(true);
    return !empty($terminal) ? get_permalink($terminal->ID) : false;
}