Two days ago, the author of THE MORNING AFTER, Arun Kale, surprised me with a message on his forum.
Hello, all. I have moved the Morning After theme to Google Code. It will now be available at this location. I have also adopted the MIT License for the theme. […] I am open to accepting contributions to the theme from users of the theme — provided you know what you’re doing, of course.
Especially, the last sentence caught my attention. In my opinion, this offers US the opportunity to adopt this great magazine-style theme faster to new functionalities of WordPress. Having said that, here is my first contribution:
Since version 2.5, WordPress supports built-in galleries. So, I have added a gallery archive, a gallery section on home.php and an image template to my customized version of THE MORNING AFTER. The tutorial can be read here.
In my opinion, a gallery overview and a gallery section on home.php are not essential for THE MORNING AFTER, but it should offer a template file for images, so that the new built-in galleries of WordPress can be used. Therefore, I have written a new image.php template.
<?php get_header(); ?>
<div id="topbanner_single" class="column span-14"> <!-- start top banner -->
<div class="pagetitle">
// you’re viewing...
</div>
</div> <!-- end top banner -->
<div id="post_content" class="column span-14"> <!-- start home_content -->
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="column span-11 first">
<h2 class="post_cat">Images</h2>
<h2 class="post_name" id="post-<?php the_ID(); ?>"> <a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> » <?php the_title(); ?></h2>
<div class="post_meta">
By <?php the_author_posts_link(); ?> <span class="dot">⋅</span> <?php the_time('F j, Y'); ?> <span class="dot">⋅</span> <?php if(function_exists('wp_email')) { ?> <?php email_link(); ?> <span class="dot">⋅</span> <?php } ?> <?php if(function_exists('wp_print')) { ?> <?php print_link(); ?> <span class="dot">⋅</span> <?php } ?> <a href="#comments">Post a comment</a>
</div>
<div class="captionfull"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?><?php if ( !empty($post->post_excerpt) ) the_excerpt(); // this is the "caption" ?></div>
<?php the_content('<p>Continue reading this post</p>'); ?>
<div class="navigation">
<div class="alignleft"><?php previous_image_link() ?></div>
<div class="alignright"><?php next_image_link() ?></div>
</div>
<div class="post_meta">
<p><?php the_taxonomies(); ?></p>
</div>
<?php edit_post_link('Edit this entry.','<p>','</p>'); ?>
<div id="comments"> <!-- start comments -->
<div id="commenthead">
<h2 class="post_comm">Discussion</h2>
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
// Both Comments and Pings are open ?>
<h3 class="mast5"><?php comments_number('No comments', 'One comment', '% comments'); ?> for “<?php the_title(); ?>”</h3>
<?php } else {
// Neither Comments, nor Pings are open ?>
<h3 class="mast5">Comments are disallowed for this post.</h3>
<?php } ?>
</div>
<?php comments_template(); ?>
</div> <!-- end comments -->
</div>
<?php endwhile; else: ?>
<p>Lost? Go back to the <a href="<?php echo get_option('home'); ?>/">home page</a>.</p>
<?php endif; ?>
<?php get_sidebar(); ?>
</div> <!-- start home_content -->
<?php get_footer(); ?>
This template is different to the image.php offered in the „old“ tutorial. This time, the template is based on the single.php of TMA 1.3 and not on my customized version. And in contrast to the old image.php, the navigation is based on thumbs and not on text links.
To achieve the floating of the navigation thumbs, the following code must be added to the cascading style sheet:
/*image.php*/
.navigation { display: block; text-align: center; margin-top: 10px; margin-bottom: 150px; }
.alignright { float: right; }
.alignleft { float: left; }
Finally, adding the image.php template to the theme directory and updating the style.css outputs such an image page:
The title consists of the name of the parent post and the name of the image. Caption and description are below the image.
The (maximum) size of the image and the thumbnails can be edited unter WP Dashbard > Settings > Miscellaneous.
Schreibe einen Kommentar