简体   繁体   English

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

[英]Wordpress - separate blog page not showing the posts but showing the homepage of the custom theme

Wordpress - separate blog page not showing the posts and showing the homepage of the custom theme... (not redirecting to home page just showing in place of blog page with the link http://www.example.com/blog on the addressbar of the browser) Wordpress-单独的博客页面,不显示帖子,也不显示自定义主题的主页...(不重定向到主页,仅显示在地址栏上,地址栏上带有链接http://www.example.com/blog的博客页面浏览器)

As I have already adjust the setting on wp-admin following as SETTING>Reading> A static page Front page to Home (homepage of the theme) and posts to blog (separate blog page of the theme) 因为我已经调整了wp-admin上的设置,如下设置>阅读>静态页面首页到首页(主题的主页),张贴到博客(主题的单独博客页面)

And Blog page consist the following code 并且Blog页面包含以下代码

<?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(); ?>

And the Home page of the theme is almost static page. 而且主题的主页几乎是静态页面。

Make sure your static home page template is not in a file called index.php or home.php . 确保您的静态主页模板不在名为index.phphome.php的文件中。 If WordPress detects any one of those files it will automatically assume it is the template for your posts. 如果WordPress检测到其中任何一个文件,它将自动假定它是您的帖子模板。 Therefore create a front-page.php or similar for your static home page and index.php or home.php for your posts page. 因此,为您的静态主页创建一个front-page.php或类似内容,为您的帖子页面创建index.phphome.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM