2012-08-17 352 views
1

我们的博客网页应该是这个样子:http://livedemo00.template-help.com/wordpress_33821/?page_id=174WordPress的页面模板不渲染

然而它结束了寻找这样的 - 完全是空的!

尽管这是该网页的主题是正确设置和模板文件包含以下代码的事实:

<?php 
/** 
* Template Name: Blog 
*/ 

get_header(); ?> 
<div class="box clearfix color2"> 
    <div id="content" class="three_fourth"> 

    <?php 
    $temp = $wp_query; 
    $wp_query= null; 
    $wp_query = new WP_Query(); 
    $wp_query->query('showposts=5'.'&paged='.$paged); 
    ?> 
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?> 
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 
     <header> 
     <h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a></h2> 
     <div class="post-meta"> 
      <div class="fleft">Posted in: <?php the_category(', ') ?> | <time datetime="<?php the_time('Y-m-d\TH:i'); ?>"><?php the_time('F j, Y'); ?> at <?php the_time() ?></time> , by <?php the_author_posts_link() ?></div> 
      <div class="fright"><?php comments_popup_link('No comments', 'One comment', '% comments', 'comments-link', 'Comments are closed'); ?></div> 
     </div><!--.post-meta--> 
     </header> 
     <?php echo '<div class="featured-thumbnail">'; the_post_thumbnail(); echo '</div>'; ?> 
     <div class="post-content"> 
     <div class="excerpt"><?php $excerpt = get_the_excerpt(); echo my_string_limit_words($excerpt,50);?><a href="<?php the_permalink() ?>" class="link-more">Read more</a></div> 
     </div> 
    </article> 

    <?php endwhile; ?> 

    <?php if ($wp_query->max_num_pages > 1) : ?> 
    <nav class="oldernewer"> 
     <div class="older"> 
     <?php next_posts_link('&laquo; Older Entries') ?> 
     </div><!--.older--> 
     <div class="newer"> 
     <?php previous_posts_link('Newer Entries &raquo;') ?> 
     </div><!--.newer--> 
    </nav><!--.oldernewer--> 
    <?php endif; ?> 

    <?php $wp_query = null; $wp_query = $temp;?> 

</div><!--#content--> 
<?php get_sidebar(); ?> 
</div> 
<?php get_footer(); ?> 

不幸的是这个主题没有任何文件,所以我不得不寻找我自己解。

+1

博客是否有任何内容?即您是否添加了页面和帖子? – James 2012-08-17 03:16:27

+0

有一个帖子被添加到博客中。它可以在这里看到 - http://isabel-almeida.com.au/tinting-eyebrows 我已经设置博客页面作为显示帖子的地方使用设置>阅读选项。 除此之外,我还没有做任何事情告诉wordpress将帖子放在博客页面上。我可能会错过一些非常明显的... – 2012-08-17 03:17:11

+0

@BryceSummerell。转到网页并编辑博客页面,在下拉列表中将“页面模板”设置为“博客”,并保存 – Ben 2012-08-17 03:20:13

回答

0

其实我在WordPress已经遇到过这种情况。 它不是你的代码的错。可能是WordPress的错误。

尝试更改一次您的页面名称。 像

<?php 
/** 
* Template Name: Blog_new 
*/ 
?> 

并重新登录,并检查其是否显示新的自定义页面选项或不。