1

私たちのブログページは次のようになります: 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('&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(); ?>

残念ながら、このテーマにはドキュメントがないため、独自の解決策を見つける必要があります。

4

1 に答える 1

0

実際、私はWordPressですでにこの状況に直面しました。あなたのコードのせいではありません。WordPressのバグかもしれません。

ページ名を一度変更してみてください。お気に入り

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

再度ログインして、新しいカスタム ページ オプションが表示されているかどうかを確認します。

于 2012-08-17T06:38:00.970 に答える