function comicpress_random_post() { $randomComicQuery = new WP_Query(); $randomComicQuery->query('showposts=1&orderby=rand&cat=' . comicpress_exclude_comic_categories()); while ($randomComicQuery->have_posts()) { $randomComicQuery->the_post(); $random_comic_id = get_the_ID(); } define('DONOTCACHEPAGE', true); wp_redirect(get_permalink($random_comic_id)); exit; }
function comicpress_dual_columns($whereclause = false) { global $wp_query; ?> <div id="dualcolumns"> <div class="column_one"> <div class="column_one_header"></div> <?php Protect(); $wp_query->in_the_loop = true; $blog_query = new WP_Query(); if ($whereclause) { add_filter('posts_where', 'comicpress_dual_filter_where'); } $blog_query->query('showposts=' . comicpress_themeinfo('blog_postcount') . '&cat=' . comicpress_exclude_comic_categories() . '&author=' . comicpress_themeinfo('author_column_one') . '&paged=' . $paged); if (have_posts()) { while ($blog_query->have_posts()) { $blog_query->the_post(); comicpress_display_post(); } } UnProtect(); ?> </div> <div class="column_two"> <div class="column_two_header"></div> <?php Protect(); $wp_query->in_the_loop = true; $blog_query = new WP_Query(); if ($whereclause) { add_filter('posts_where', 'comicpress_dual_filter_where'); } $blog_query->query('showposts=' . comicpress_themeinfo('blog_postcount') . '&cat=' . comicpress_exclude_comic_categories() . '&author=' . comicpress_themeinfo('author_column_two')); if (have_posts()) { while ($blog_query->have_posts()) { $blog_query->the_post(); comicpress_display_post(); } } UnProtect(); ?> </div> <div class="clear"></div> </div> <?php }
if (have_posts()) { while (have_posts()) { the_post(); $blog_query = 'showposts=' . comicpress_themeinfo('blog_postcount') . '&order=asc&cat=' . comicpress_exclude_comic_categories(); if (!comicpress_in_comic_category() || comicpress_in_comic_category() && !comicpress_themeinfo('disable_comic_blog_single')) { comicpress_display_post(); comments_template('', true); $blog_query = 'showposts=' . comicpress_themeinfo('blog_postcount') . '&order=asc&cat=' . comicpress_exclude_comic_categories(); } } if (is_active_sidebar('blog')) { get_sidebar('blog'); } if (comicpress_themeinfo('static_blog') && comicpress_in_comic_category()) { if (!comicpress_themeinfo('split_column_in_two')) { $blog_query = 'showposts=' . comicpress_themeinfo('blog_postcount') . '&cat=' . comicpress_exclude_comic_categories() . '&paged=' . $paged; $posts =& query_posts($blog_query); if (have_posts()) { ?> <?php if (!comicpress_themeinfo('disable_blogheader')) { ?> <div id="blogheader"><!-- This area can be used for a heading above your main page blog posts --></div> <?php } ?> <?php if (comicpress_themeinfo('enable_caps')) { ?>
<?php /* Template Name: Blog */ get_header(); $temp_query = $wp_query; if (!comicpress_themeinfo('split_column_in_two')) { $paged = get_query_var('paged'); $blog_query = 'cat=' . comicpress_exclude_comic_categories() . '&paged=' . $paged; $posts =& query_posts($blog_query); if (have_posts()) { ?> <div class="blogindex-head"></div> <div class="blogindex"> <?php while (have_posts()) { the_post(); comicpress_display_post(); } ?> </div> <div class="blogindex-foot"></div> <?php } comicpress_pagination(); } else { comicpress_dual_columns(); } $wp_query = $temp_query; $temp_query = null;
function widget($args, $instance) { global $wp_query, $post; Protect(); extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $before_title . $title . $after_title; } ?> <div class="archive-dropdown-wrap"> <select name="archive-dropdown" class="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=""><?php echo esc_attr(__('Archives...', 'comicpress')); ?> </option> <?php switch ($instance['mode']) { case "monthly": wp_get_archives('type=monthly&format=option&show_post_count=-1'); break; case "yearly": wp_get_archives('type=yearly&format=option&show_post_count=-1'); break; case "allposts": wp_get_archives('type=postbypost&format=option&show_post_count=-1'); break; case "blogposts": $comicArchive = new WP_Query(); $comicArchive->query('showposts=-1&cat=-' . comicpress_exclude_comic_categories()); while ($comicArchive->have_posts()) { $comicArchive->the_post(); ?> <option value="<?php echo get_permalink($post->ID); ?> "><?php the_title(); ?> </option> <?php } break; case "comicposts": $comicArchive = new WP_Query(); $comicArchive->query('showposts=-1&cat=' . comicpress_all_comic_categories_string()); while ($comicArchive->have_posts()) { $comicArchive->the_post(); ?> <option value="<?php echo get_permalink($post->ID); ?> "><?php the_title(); ?> </option> <?php } break; case "currentcat": $currentcat = get_the_category($post->ID); $currentcat = $currentcat[0]->cat_ID; $comicArchive = new WP_Query(); $comicArchive->query('showposts=-1&cat=' . $currentcat); while ($comicArchive->have_posts()) { $comicArchive->the_post(); ?> <option value="<?php echo get_permalink($post->ID); ?> "><?php the_title(); ?> </option> <?php } break; case "allcats": $args = array('hide_empty' => 1, 'orderby' => 'group'); $categories = get_categories($args); foreach ($categories as $cat) { if ($cat->category_count > 0) { $option = '<option value="' . get_category_link($cat->term_id) . '">'; $option .= $cat->cat_name; $option .= ' (' . $cat->category_count . ')'; $option .= '</option>'; echo $option; } } break; case "blogcats": $args = array('hide_empty' => 1, 'orderby' => 'group', 'order' => 'ASC', 'exclude' => comicpress_all_comic_categories_string()); $categories = get_categories($args); foreach ($categories as $cat) { if ($cat->category_count > 0) { $option = '<option value="' . get_category_link($cat->term_id) . '">'; $option .= $cat->cat_name; $option .= ' (' . $cat->category_count . ')'; $option .= '</option>'; echo $option; } } break; case "storylines": if (($result = comicpress_themeinfo('storyline-category-order')) !== false) { $comicpress_storyline_dropdown_archive = wp_cache_get('comicpress', 'archivedropdown'); if (empty($comicpress_storyline_dropdown_archive)) { $categories_by_id = comicpress_get_comic_category_objects_by_id(); $current_depth = 0; $comicpress_storyline_dropdown_archive = ''; foreach (explode(",", $result) as $node) { $parts = explode("/", $node); $target_depth = count($parts) - 1; $category_id = end($parts); $category = $categories_by_id[$category_id]; $description = $category->description; $first_comic_in_category = comicpress_get_terminal_post_in_category($category_id); $first_comic_permalink = get_permalink($first_comic_in_category->ID); $padding = str_repeat(" ", $target_depth - 1); $option = '<option value="' . get_category_link($category_id) . '">'; $option .= $padding . $category->name; if ($category->count > 0) { $option .= ' (' . $category->count . ')'; } $option .= '</option>' . "\r\n"; $comicpress_storyline_dropdown_archive .= $option; $current_depth = $target_depth; } wp_cache_set('comicpress', $comicpress_storyline_dropdown_archive, 'archivedropdown', 7200); } echo $comicpress_storyline_dropdown_archive; } break; case "comiccats": default: $args = array('hierarchical ' => 1, 'orderby' => 'group', 'include' => comicpress_all_comic_categories_string()); $categories = get_categories($args); foreach ($categories as $cat) { if ($cat->category_count > 0) { $option = '<option value="' . get_category_link($cat->term_id) . '">'; $option .= $cat->cat_name; $option .= ' (' . $cat->category_count . ')'; $option .= '</option>'; echo $option; } } break; } ?> </select> </div> <?php echo $after_widget; UnProtect(); }