Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
adding date.php and fixing archive.php
Browse files Browse the repository at this point in the history
date.php now handles yearly monthly and daily archives.
archive.php handles tag archives and taxonomy archives.
  • Loading branch information
Steve Lambert authored and Steve Lambert committed Jul 17, 2010
1 parent 6cf124e commit 2031fd1
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 80 deletions.
153 changes: 76 additions & 77 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,93 +8,92 @@
<!-- generated with archive.php -->

<!-- begin post -->
<div id="content" class="entry">
<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?>
<h2 class="pagetitle"><?php echo single_cat_title(); ?></h2>


<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle">Artist Archive</h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<?php /*if this is a year archive */ } elseif (is_archive()) { ?>
<h2 class="pagetitle"><?php wp_title(''); ?></h2>

<!-- START: why is this here? -->
<div class="entry"></div><!-- .entry -->
<!-- END: why is this here? -->

<?php } ?>



<div class="entrycat">



<div class="img-container">

<?php while (have_posts()) : the_post(); ?>
<?php /* if(in_category('news','latest', 'updates', 'blog', 'notable')) continue; */ ?>
<?php
$reserved_names = array('news','latest', 'updates', 'blog', 'notable','News','Latest', 'Updates', 'Blog', 'Notable');
$category = get_the_category();
$categories_to_exclude = $category[0]->cat_name;
if (in_array($categories_to_exclude, $reserved_names)) continue;
?>

<div class="img-frame">

<a title="'<?php the_title_attribute(); ?>', <?php the_time('Y') ?>" href="<?php the_permalink() ?>">




<?php

<div id="content" class="entry archive notable">

<?php // This code is adapted from the kubrick theme's archive.php ?>
<?php if (have_posts()) : ?>

<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a tag archive */ if (is_tag()) { ?>
<h2 class="pagetitle">Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h2>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h2 class="pagetitle">Artist Archive</h2>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h2 class="pagetitle">Archives</h2>
<?php } ?>

<?php while (have_posts()) : the_post(); ?>

<div class="notable-post">
<div class="archive-result">

<a title="'<?php the_title_attribute(); ?>', <?php the_time('Y') ?>" href="<?php the_permalink() ?>">

<?php


#If there is a post thumbnail , it will display. If not it is the thumb function. These
# can be edited in the functions.php file.

if(has_post_thumbnail()){
the_post_thumbnail();
}
else{


echo get_thumb($post->ID);
}




?>



</a>

<!--POST TITLE-->
<h2 class="post-title"><a title="'<?php the_title_attribute(); ?>', posted on <?php the_time('F jS, Y') ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<!--END POST TITLE-->

<h4><?php the_date('F d, Y', '', ''); ?></h4>

<?php the_excerpt('continue...'); ?>

#If there is a post thumbnail , it will display. If not it is the thumb function. These
# can be edited in the functions.php file.

if(has_post_thumbnail()){
the_post_thumbnail();
}
else{


echo get_thumb($post->ID);
}




?>



</a>
<br />
<div class="img-frame-caption"><a title="'<?php the_title_attribute(); ?>', <?php the_time('Y') ?>" href="<?php the_permalink() ?>"><?php the_title('' ); ?></a>
</div><!-- .img-frame-caption -->
</div><!-- .img-frame -->

<?php endwhile; ?>

</div><!-- img-container-->
</div><!-- entrycat -->
<h5 class="clear-both"><?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'), __(''), __('')); ?> <?php the_tags('| Tags: ',', ',''); ?> <?php edit_post_link('edit this', '<span class="edit-link">', '</span>'); ?> <!--USER EDIT LINK--></h5>
</div><!-- .archive-result -->
</div><!-- .notable-post -->

<?php endwhile; ?>

<div class="entry">

<div class="prevnext">
<div class="prev"><?php previous_post_link('%link', 'Newer', TRUE); ?></div> <div class="next"><?php next_post_link('%link', 'Older', TRUE); ?></div>
</div> <!--.prevnext -->

<?php else : ?>
<h2 class="center">Sorry, page not found</h2>
<?php endif; ?>

<?php else :

if ( is_author() ) { // If this is an author archive
$userdata = get_userdatabylogin(get_query_var('author_name'));
printf("<h2 class='center'>Sorry, but there aren't any posts by %s yet.</h2>", $userdata->display_name);
} else if ( is_date() ) { // If this is a date archive
echo("<h2>Sorry, but there aren't any posts with this date.</h2>");
} else {
echo("<h2 class='center'>No posts found.</h2>");
}
get_search_form();

endif;
?>

</div> <!-- .entry -->
<!-- end post -->
</div><!-- #content -->

<?php get_sidebar(); ?>

<?php

// calling footer.php
Expand Down
107 changes: 107 additions & 0 deletions date.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php

// calling the header.php
get_header();

?>

<!-- generated with date.php (this template is designed to just show art/portfolio posts in the yearly archive view) -->

<!-- begin post -->
<div id="content" class="entry date">

<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>



<?php /* If this is a daily archive */ if (is_day()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>

<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>

<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>

<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h2 class="pagetitle">Archives</h2>

<?php /*if this is a year archive */ } elseif (is_archive()) { ?>
<h2 class="pagetitle"><?php wp_title(''); ?></h2>
<?php } ?>

<div class="entrycat">

<div class="img-container">

<?php while (have_posts()) : the_post(); ?>


<?php /* if(in_category('news','latest', 'updates', 'blog', 'notable')) continue; */ ?>
<?php
// This section of code removes posts from the archive if they are in a blog/news category
// This is done so the yearly archives are just art/portfolio posts
$reserved_names = array('news','latest', 'updates', 'blog', 'notable','News','Latest', 'Updates', 'Blog', 'Notable');
$category = get_the_category();
$categories_to_exclude = $category[0]->cat_name;
if (in_array($categories_to_exclude, $reserved_names)) continue;
?>

<div class="img-frame">

<a title="'<?php the_title_attribute(); ?>', <?php the_time('Y') ?>" href="<?php the_permalink() ?>">

<?php

#If there is a post thumbnail , it will display. If not it is the thumb function. These
# can be edited in the functions.php file.

if(has_post_thumbnail()){
the_post_thumbnail();
}
else{

echo get_thumb($post->ID);
}
?>

</a>
<br />
<div class="img-frame-caption"><a title="'<?php the_title_attribute(); ?>', <?php the_time('Y') ?>" href="<?php the_permalink() ?>"><?php the_title('' ); ?></a>
</div><!-- .img-frame-caption -->
</div><!-- .img-frame -->

<?php endwhile; ?>

</div><!-- img-container-->
</div><!-- entrycat -->

<div class="entry">

<div class="prevnext">
<div class="prev"><?php previous_post_link('%link', 'Newer', TRUE); ?></div> <div class="next"><?php next_post_link('%link', 'Older', TRUE); ?></div>
</div> <!--.prevnext -->

<?php else :

if ( is_date() ) { // If this is a date archive
echo("<h2>Sorry, but there aren't any posts with this date.</h2>");
} else {
echo("<h2 class='center'>No posts found.</h2>");

}
get_search_form();

endif
?>

</div> <!-- .entry -->
<!-- end post -->
</div><!-- #content -->
<?php

// calling footer.php
get_footer();

?>
4 changes: 2 additions & 2 deletions search.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<?php if (! empty($display_stats) ) { get_stats(1); echo "<br />"; } else if (($posts & empty($display_stats)) ) : foreach ($posts as $post) : the_post(); ?>

<div class="notable-post">
<div class="search-result">
<div class="archive-result">

<a title="'<?php the_title_attribute(); ?>', <?php the_time('Y') ?>" href="<?php the_permalink() ?>">

Expand Down Expand Up @@ -54,7 +54,7 @@
<?php the_excerpt('continue...'); ?>

<h5 class="clear-both"><?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)'), __(''), __('')); ?> <?php the_tags('| Tags: ',', ',''); ?> <?php edit_post_link('edit this', '<span class="edit-link">', '</span>'); ?> <!--USER EDIT LINK--></h5>
</div><!-- .search-result -->
</div><!-- .archive-result -->
</div><!-- .notable-post -->


Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ code {
font-weight : normal;
text-align : justify;
}
div.search-result img {
div.archive-result img {
float: left;
margin-right: 2em;
margin-bottom: 1em;
Expand Down

0 comments on commit 2031fd1

Please sign in to comment.