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

廉价感情. 提交于 2020-01-05 05:28:04

问题


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)

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)

And Blog page consist the following code

<?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.


回答1:


Make sure your static home page template is not in a file called index.php or home.php. If WordPress detects any one of those files it will automatically assume it is the template for your posts. Therefore create a front-page.php or similar for your static home page and index.php or home.php for your posts page.



来源:https://stackoverflow.com/questions/22971762/wordpress-separate-blog-page-not-showing-the-posts-but-showing-the-homepage-of

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!