I have been successfully using a static front page on a theme I am building (locally so can't share URL) without any issues. Suddenly it has stopped working and I can't work out why. I now see a blank page instead of my blog category posts.
The last change I made between it working and breaking was to add a
<?php else: ?> statement into my index.php along with
&! is_front_page() into the if statement so that I can show different content on my static home page.
<?php get_header(); ?> <div id="content"> <?php if ( have_posts() &! is_front_page() ) : ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'posts', get_post_format() ); ?> <?php endwhile; ?> <?php else: ?> This is the front page! <?php endif; // end have_posts() check ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
I have tried reloading the permalinks page, and re-creating the Home static page and setting it up in the Reading settings page, but nothing seems to resolve the issue.
I have obviously removed the lines I added too, but that didn't resolve the issue either!
My permalink settings are set to postname and category base as
. to remove the category part from the URL (again this was working previously). If I remove the category base, then the category works, but the URL is wrong then.
Going to the blog static page I am getting:
is_front_page() = false have_posts() = false
Hope that all makes sense! Using Wordpress 3.9.1 -- I am relatively new to Wordpress and learning themes which is why its not live. Let me know if there is any other code/settings that you would need to know! I am also using custom post types with custom taxonomies using hierarchical taxonomies.
I found this page that guides to do what I wanted to do, and I had to put the permalink to
/%category%/%postname%/ instead of just
/%postname%/ and that has got it working again.
However, I set up a new wordpress site on the same computer with a different URL and copied my theme to it, along with creating the relevant files and the existing method I was using worked there. I'm very puzzled now :/
So when I refreshed the permalinks on the 2nd site, it broke the blog url... so I guess this is the solution!