Skip to content

Instantly share code, notes, and snippets.

@EdwardIII
Created May 19, 2011 09:03
Show Gist options
  • Save EdwardIII/980442 to your computer and use it in GitHub Desktop.
Save EdwardIII/980442 to your computer and use it in GitHub Desktop.
<?php
/*
Template Name: Home
*/
get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php
/* Get the images for the concertina */
$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID );
$attachments = get_posts($args);
if ($attachments) {
foreach ( $attachments as $attachment ) {
echo apply_filters( 'the_title' , $attachment->post_title );
echo apply_filters( 'the_content' , $attachment->post_excerpt);
the_attachment_link( $attachment->ID , false );
}
}
?>
<?php
/* Get the home content blocks */
$type = 'block';
$args=array(
'post_type' => $type,
'post_status' => 'publish',
'paged' => 0,
'orderby' => 'menu_order',
'order' => 'ASC',
#'posts_per_page' => 2,
#'caller_get_posts'=> 1
);
$temp = $wp_query; // assign orginal query to temp variable for later use
$wp_query = null;
$wp_query = new WP_Query($args);
?>
<?php
/* Run the loop to output the page.
* If you want to overload this in a child theme then include a file
* called loop-page.php and that will be used instead.
*/
//get_template_part( 'loop', 'page' );
?>
<!-- Start the Loop. -->
<?php $i = 1; if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="post<?php if($i % 3 == 0){ echo ' last'; }?>">
<!-- Display the Title as a link to the Post's permalink. -->
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<!-- Display the Post's Content in a div box. -->
<div class="entry">
<?php the_content(); ?>
</div>
<!-- Display a comma separated list of the Post's Categories. -->
</div> <!-- .home-post -->
<!-- Stop The Loop (but note the "else:" - see next line). -->
<?php $i++; endwhile; else: ?>
<!-- The very first "if" tested to see if there were any Posts to -->
<!-- display. This "else" part tells what do if there weren't any. -->
<p>Sorry, no posts matched your criteria.</p>
<!-- REALLY stop The Loop. -->
<?php endif; ?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment