• Instead of using index.php as my front page, I’ve created a custom page and changed the “Front page displays” setting in the “Reading Settings” tab accordingly.

    I need for the home page to be a custom page because I’m using custom fields so the client can edit bits of content easily enough. This is why I’m not using index.php or home.php

    Loops don’t seem to be working with my custom front page, although they still work on index.php.

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <--- POST CONTENT -->
    <?php endwhile; ?>
    <?php else : ?>
    <?php endif; ?>

    What might I be doing wrong? Is there some other bit of code I need to include?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Is your custom front page called front-page.php?

    That’s what it should be called.
    The loop looks ok to me. It should be the exact same code as on the page.php

    on a page template, you need to tell the loop what it has to show;

    add for example this before your code:

    <?php query_posts( array( 'posts_per_page' => get_option('posts_per_page'), 'paged' => get_query_var('paged') ) ); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Loop not working on custom front page’ is closed to new replies.