-
<?php
/*
Template Name: Test
*/
?>
<?php get_header(); ?>
<?php /* get current page name for using category */
global $notfound;
if (is_page() and ($notfound != '1')) {
$page_query = $wpdb->get_row("SELECT ID, post_name FROM $wpdb->posts WHERE ID = '$post->ID'");
$current_page = $page_query->post_name;
$cat_query = $wpdb->get_row("SELECT term_id FROM $wpdb->terms WHERE name = '$current_page'");
$current_cat = $cat_query->term_id;
}
?>
<div id="content">
<?php query_posts(array('category__and'=>array($current_cat,60),'showposts'=>1));
/* 60 = top category */
if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="post-top">
<table class='layout'><tr><td>
<?php
/* get the first attachment id from the post id /*$tempid = intval($post->ID);
$attachments = get_children("post_parent=$tempid&post_type=attachment&post_mime_type=image");
if ( !empty($attachments) ) {
foreach ($attachments as $tempid => $value) {
$imageid[] = $tempid;
}/* get the medium size image */
echo wp_get_attachment_link($imageid[0], 'medium', true, false);
}
?>
</td><td>
<h2><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
</td></tr></table>
</div><!--/post-top -->
<?php endwhile; endif; ?>
<div class="post-middle">
<?php query_posts(array('category__and'=>array($current_cat,61),'showposts'=>3)); - /* 61 = middle category */
- if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="middle-entry">
<h2><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
by <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<?php the_author_posts_link(); ?></a> on <?php the_time('n/j/y') ?>
</div><!--/entry -->
<?php endwhile; endif; ?>
</div><!--/post-middle -->
<br style="clear:both" />
<div class="post-bottom">
<?php query_posts(array('category__and'=>array($current_cat,62),'showposts'=>6)); - /* 62 = bottom category */
- if (have_posts()) : while (have_posts()) : the_post(); ?>
<ul>
<li><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></li>
</ul>
<?php endwhile; endif; ?>
</div><!--/post-bottom-->
</div><!--/content -->
</div><!--/left-col -->
<?php get_sidebar(); ?> - <?php get_footer(); ?>