我们的博客页面应该是这样的:http ://livedemo00.template-help.com/wordpress_33821/?page_id=174
然而它最终看起来像这样 - 完全是空的!
尽管页面主题设置正确并且模板文件包含以下代码,但还是会出现这种情况:
<?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('« Older Entries') ?>
</div><!--.older-->
<div class="newer">
<?php previous_posts_link('Newer Entries »') ?>
</div><!--.newer-->
</nav><!--.oldernewer-->
<?php endif; ?>
<?php $wp_query = null; $wp_query = $temp;?>
</div><!--#content-->
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>
不幸的是,这个主题没有任何文档,所以我不得不找到自己的解决方案。