Skip to content

Instantly share code, notes, and snippets.

@scottnix
Forked from Jagst3r15/gist:2641281
Created May 9, 2012 02:33
Show Gist options
  • Save scottnix/2641351 to your computer and use it in GitHub Desktop.
Save scottnix/2641351 to your computer and use it in GitHub Desktop.
<?php
/*
Template Name: Front Page
.
Take a look at the functions.php for this theme to see how the random content is included.
.
*/
?>
<?php get_header() ?>
<div id="container" class="feature">
<div id="content">
<div id="sub-feature">
<div id="front-block-1" class="front-block block">
<?php if ( function_exists('wp_tag_cloud') ) : ?>
<ol>
<h3>Popular Tags</h3>
<ul>
<?php wp_tag_cloud('smallest=8&largest=20'); ?>
</ul>
</ol>
<?php endif; ?>
</div><!-- #front-block-1.front-block .block-->
<div id="front-block-2" class="front-block block">
<?php
// display one post, most recent single post, ignores sticky posts
// http://codex.wordpress.org/Class_Reference/WP_Query
$my_query = new WP_Query( array( 'post_type=post', 'posts_per_page' => 1, 'ignore_sticky_posts' => 1 ) );
echo '<ul class="featured-posts">';
while ($my_query->have_posts()) : $my_query->the_post();?>
<li>
<?php
$posttitle = '<h3><a href="';
$posttitle .= get_permalink();
$posttitle .= '" title="';
$posttitle .= the_title_attribute('echo=0');
$posttitle .= '" rel="bookmark">';
$posttitle .= get_the_title();
$posttitle .= "</a></h3>\n";
echo $posttitle;
if ( has_post_thumbnail() ) { ?> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?></a><?php
}
else { ?> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute('echo=0'); ?>"><img height="120" width="210" src="<?php bloginfo('stylesheet_directory'); ?>/images/testimage.png" /></a><?php
}
the_excerpt();
echo '<a href="'. get_permalink() . '">' .__('View &raquo;', 'thematic') . '</a>';
?>
</li>
<?php
endwhile;
echo '</ul>';
?>
</div><!-- #front-block-2 .front-block .block-->
</div><!-- #sub-feature -->
</div><!-- #content -->
</div><!-- #container .feature -->
<?php get_footer() ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment