Skip to content

Instantly share code, notes, and snippets.

@JLeuze
Created February 8, 2014 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JLeuze/8877535 to your computer and use it in GitHub Desktop.
Save JLeuze/8877535 to your computer and use it in GitHub Desktop.
Homepage featured slideshow for Hatch Pro Theme
<?php
/**
* Template Name: Home
*
* A custom page template for displaying the homepage.
*
* @package Hatch Pro
* @subpackage Template
*/
get_header(); // Loads the header.php template. ?>
<?php do_atomic( 'before_masthead' ); // hatch_pro_before_masthead ?>
<?php if ( is_front_page() ) { ?>
<div id="masthead">
<?php do_atomic( 'open_masthead' ); // hatch_pro_open_masthead ?>
<?php /* Get the 'Author Info' theme setting if not empty. Fallback to the admin's biography. */
$hatch_pro_author_bio = hybrid_get_setting( 'hatch_pro_author_bio' ) ? hybrid_get_setting( 'hatch_pro_author_bio' ) : get_the_author_meta( 'description', '1' ); ?>
<div id="author-bio"><?php echo do_shortcode( $hatch_pro_author_bio ); ?></div>
<div id="header-banner" role="banner">
<?php if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow(); } ?>
</div>
<?php if ( hybrid_get_setting( 'hatch_pro_callout' ) ) { ?>
<div id="callout"><div class="inside"><?php echo do_shortcode( hybrid_get_setting( 'hatch_pro_callout' ) ); ?></div></div>
<?php } ?>
<?php do_atomic( 'close_masthead' ); // hatch_pro_close_masthead ?>
</div>
<?php } ?>
<?php do_atomic( 'before_content' ); // hatch_pro_before_content ?>
<div id="content">
<?php do_atomic( 'open_content' ); // hatch_pro_open_content ?>
<div class="hfeed">
<?php // Settings for latest posts loop
global $post;
$klhatch_posttemp = $post;
$klhatch_loop = new WP_Query( array(
'posts_per_page' => 6
) );
if ( $klhatch_loop->have_posts() ) :
while ( $klhatch_loop->have_posts() ) : $klhatch_loop->the_post();
get_template_part( 'content', ( post_type_supports( get_post_type(), 'post-formats' ) ? get_post_format() : get_post_type() ) );
endwhile;
//Reset the recent posts loop
$post = $klhatch_posttemp;
wp_reset_postdata(); ?>
<?php else : ?>
<?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?>
<?php endif; ?>
</div><!-- .hfeed -->
<?php do_atomic( 'close_content' ); // hatch_pro_close_content ?>
<?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?>
</div><!-- #content -->
<?php do_atomic( 'after_content' ); // hatch_pro_after_content ?>
<?php get_footer(); // Loads the footer.php template. ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment