首页 文章

Wordpress - 单独的博客页面不显示帖子,但显示自定义主题的主页

提问于
浏览
1

Wordpress - 单独的博客页面没有显示帖子和显示自定义主题的主页...(没有重定向到主页只显示代替博客页面与浏览器的地址栏上的链接http://www.example.com/blog

因为我已经调整 wp-admin 上的设置,因为 SETTING>Reading> A static page Front page to Home (homepage of the theme)posts to blog (separate blog page of the theme)

博客页面包含以下代码

<?php
/*
Template Name: Blog
*/

get_header();

if ( have_posts() ) :
  // Start the Loop.
  while ( have_posts() ) : the_post();
    get_template_part( 'content', get_post_format() );
  endwhile;
  // Previous/next post navigation.
  next_previous_paging_nav();
else :
  // If no content, include the "No posts found" template.
  get_template_part( 'content', 'none' );
endif;

get_footer(); ?>

主题的主页几乎是静态页面 .

1 回答

  • 0

    确保您的静态主页模板不在名为 index.phphome.php 的文件中 . 如果WordPress检测到这些文件中的任何一个,它将自动认为它是您帖子的模板 . 因此,为您的静态主页创建 front-page.php 或类似内容,为您的帖子页面创建 index.phphome.php .

相关问题