我很难在主页上以我希望的方式显示来自单个类别的帖子。我使用的主题在主页上使用了3列布局,在博客页面上使用了内容侧栏布局。
基本上我想要homepage 完全按照blog page, 但包括滑块。所以我只是从category.php
并将其粘贴到名为hompage.php
并将其设置为我的主页。
但出于某种原因,它没有显示任何帖子,我也不知道为什么。
类别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(); ?>
循环。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; ?>
如有任何建议,将不胜感激!