I'm having trouble displaying posts from a single category on the homepage the way I want them to appear. The theme I'm using uses a 3 column layout for the homepage and a content-sidebar layout for the blog page.
Basically I want the homepage to display exactly like the blog page, but include the slider. So what I did was just copy the code from category.php
and pasted it into a new custom page template titled hompage.php
and set that as my homepage.
But for some reason its not displaying any posts and I have no idea why.
category.php
<?php
/**
* The template for displaying Category pages.
*
*/
$settings = get_option( "ntl_theme_settings" );
get_header(); ?>
<div class="outer">
<div class="frameset container clear">
<?php if ($settings['ntl_disable_audio'] != 'off'){ ?>
<div class="clear headtop">
<div class="page-title" >
<h1 class="vfont"><?php single_cat_title(); ?></h1>
</div>
<?php echo lets_get_albumselector(); ?>
<?php echo lets_get_musicplayer(); ?>
</div>
<?php } else { ?>
<div class="clear headtop" style="height: auto;">
<div class="page-title" style="width: 100%; margin-bottom: 40px;">
<h1 class="vfont"><?php single_cat_title(); ?></h1>
</div>
</div>
<?php } ?>
<?php if (!$settings['ntl_show_timer']) { ?>
<div class="cdowntop">
<?php echo get_for_timer(''); ?>
<?php } else { ?>
<div class="cdownnone">
<?php } ?>
<div class="bodymid hfeed hpage">
<?php if ($settings['ntl_disable_audio'] != 'off'){ ?>
<div class="drawer"> </div>
<?php } ?>
<div id="main">
<div id="content" role="main">
<div class="container clear">
<div class="grid8 first">
<div id="content" role="main">
<?php get_template_part( 'loop', 'category' ); ?>
<?php adminace_paging(); ?>
</div>
</div>
<?php get_sidebar(); ?>
</div>
</div>
</div>
</div>
</div>
<?php lets_make_carousel(); ?>
<?php get_footer(); ?>
loop.php
<?php
/**
* The loop that displays posts.
*
*/
?>
<?php /* If there are no posts to display */ ?>
<?php if ( ! have_posts() ) : ?>
<div id="post-0" class="post error404 not-found">
<h1 class="entry-title"><?php _e( 'Not Found', 'localize' ); ?></h1>
<div class="entry-content">
<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'localize' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</div><!-- #post-0 -->
<?php endif; ?>
<?php
/* Start the Loop.
*
*
* Without further ado, the loop:
*/ ?>
<?php while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( !is_search() ) { ?>
<h3 class="entry-title excpts vfont" style="margin: 0px;"><?php the_title(); ?></h3>
<div class="vmeta smallfont">
<?php ntl_posted_on(); ?><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' )); ?>"><?php echo get_the_author(); ?></a>
</div>
<?php
$pphoto = '';
$pphoto = get_the_post_thumbnail($post->ID, 'imlink');
if ($pphoto) {
?>
<div class="excpt">
<?php the_excerpt(); ?>
</div>
<div class="menu-content" style="width: 286px; position: relative;">
<div class="mencontent">
<div class="imgblock" ><div class="imlk imgoverlink6 menimg">
<?php the_post_thumbnail('imlink'); ?>
<a href="<?php the_permalink(); ?>"><span class="imgblockover imgoverlink6"> </span></a>
</div></div>
<div class="ctime clear smallfont">
<?php the_time('j') ?>
<?php the_time('M') ?>
</div>
</div>
</div>
<?php } else { ?>
<?php the_excerpt(); ?>
<?php } ?>
<?php } else { ?>
<div class="foodmenu searchresult">
<h2 class="entry-title vfont excpts"><?php the_title(); ?></h2>
<?php the_excerpt(); ?>
<a href="<?php the_permalink(); ?>">Read More</a>
<span class="clear"></span>
</div>
<?php } ?>
</div>
<?php comments_template( '', true ); ?>
<?php endwhile; ?>
Any suggestions would be much appreciated!
front-page.php
nothomepage.php
.homepage.php
is used when the home page just displays the most recent posts.homepage.php
is not a valid template file name, and won't be used at all, unless as a properly configured custom page template.