2012-08-17 205 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 
*/ 
?> 

並重新登錄,並檢查其是否顯示新的自定義頁面選項或不。