Edikaniu
Edikaniu

Reputation: 68

Front Page Display (Your latest posts) Blank, other pages fine

I am new to PHP and WordPress and I want to develop my theme from scratch.

From the reading settings on WordPress Dashboard I have set for the Front page displays option to 'Your latest posts', but the homepage is blank with no header or footer, although every other page works just fine.

Here is my code for index.php:

<?php get_header(); ?>

<?php 
    if(have_posts()): 

    while(have_posts()): the_post(); ?>

    <h3><?php the_title(); ?></h3>

    <small>Posted on: <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?>, in <?php the_category(); ?></small>

    <p><?php the_content(); ?></p>

    <hr>

    <?php endwhile; 

    endif;

    ?>

<?php get_footer(); ?>

Can anyone explain why this is happening?

Thank you.

Upvotes: 4

Views: 638

Answers (2)

1way
1way

Reputation: 60

Can you test to register again the permalinks ? You go i nthe dashboard on settings menu > permalinks and you click save.

Sometimes Wordpress need to register again permalinks te reset htaccess when you developp some action ( like create custom post type or others )

Upvotes: 1

James Jones
James Jones

Reputation: 3899

You may be loading another template which is a blank fil. WordPress has a hierarchy of templates set out in https://developer.wordpress.org/themes/basics/template-hierarchy/#front-page-display. For your situation the hierarchy is front-page.php, home.php, index.php, so check those first two.

Upvotes: 2

Related Questions