Skip to content

Instantly share code, notes, and snippets.

@aristath
Last active December 18, 2015 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aristath/5830168 to your computer and use it in GitHub Desktop.
Save aristath/5830168 to your computer and use it in GitHub Desktop.
<?php
/**
*
* archive.php
*
* The archive template. Used when a category, author, or date is queried.
* Note that this template will be overridden by category.php, author.php, and date.php for their respective query types.
*
* More detailed information about template’s hierarchy: http://codex.wordpress.org/Template_Hierarchy
*
*/
get_header(); ?>
<?php get_sidebar('top'); ?>
<?php
if (have_posts()) {
global $posts;
$post = $posts[0];
theme_ob_start();
// Αν είναι σχολική χρονιά, δείχνουμε τον τίτλο. Αλλιώς, προχωράμε παρακάτω
// για να δείξουμε τον τίτλο ανάλογα με το taxonomy ή τον τύπο του archive/
if (is_tax('sxoliki_xronia')){
echo '<div style="padding:6px;"><h6>' . 'Show School Year: ' . $wp_query->queried_object->name . '</h6></div>';
} elseif (is_category()) {
echo '<div style="padding:6px;"><h6>' . 'Show Category posts: ' . single_cat_title('', false) . '</h6></div>';
} elseif (is_tag()) {
echo '<div style="padding:6px;"><h6>' . 'Show Tag posts: ' . single_tag_title('', false) . '</h6></div>';
} elseif (is_day()) {
echo '<h4>' . sprintf(__('Daily Archives: <span>%s</span>', THEME_NS), get_the_date()) . '</h4>';
} elseif (is_month()) {
echo '<h4>' . sprintf(__('Monthly Archives: <span>%s</span>', THEME_NS), get_the_date('F Y')) . '</h4>';
} elseif (is_year()) {
echo '<h4>' . sprintf(__('Yearly Archives: <span>%s</span>', THEME_NS), get_the_date('Y')) . '</h4>';
} elseif (is_author()) {
the_post();
echo theme_get_avatar(array('id' => get_the_author_meta('user_email')));
echo '<h4>' . get_the_author() . '</h4>';
$desc = get_the_author_meta('description');
if ($desc) {
echo '<div class="author-description">' . $desc . '</div>';
}
rewind_posts();
} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {
echo '<h4>' . __('Blog Archives', THEME_NS) . '</h4>';
}
theme_post_wrapper(array('content' => theme_ob_get_clean(), 'class' => 'breadcrumbs'));
/* Display navigation to next/previous pages when applicable */
if (theme_get_option('theme_top_posts_navigation')) {
theme_page_navigation();
}
/* Start the Loop */
while (have_posts()) {
the_post();
get_template_part('content', get_post_format());
}
/* Display navigation to next/previous pages when applicable */
if (theme_get_option('theme_bottom_posts_navigation')) {
theme_page_navigation();
}
} else {
theme_404_content();
}
?>
<?php get_sidebar('bottom'); ?>
<?php get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment