问题
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