• Anyone have any idea why this loop isn’t working? Nothing displays and I already have several posts:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_content(); wp_link_pages(); ?>
    <?php endwhile; endif; ?>

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • which php file do you placed the code?

    Thread Starter chopsky

    (@chopsky)

    it’s in page.php

    you might need to add a query before the code;

    if this is your secondary loop in page.php then probably better use WP_Query()https://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts?rq=1

    what is the full code of page.php right now?
    and what exactly are you trying to achieve?

    Thread Starter chopsky

    (@chopsky)

    I have created a “Blog” page which I have set to be a static page for the Front page to display. I have set the Blog page to the Default Template, which I believe is page.php. I simply want my site’s home page to be the blog.

    The code is as below:

    <?php get_header(); ?>
    
    <?php if (function_exists('dynamic_sidebar') && is_page() && is_active_sidebar('page-sidebar')): ?>
    <div class="siteColumnLeft clearfix">
    <?php endif; ?>
    
    <div class="separator"></div>
    
    <!-- Content -->
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_content(); wp_link_pages(); ?>
    <?php endwhile; endif; ?>
    
    <?php if (function_exists('dynamic_sidebar') && is_page() && is_active_sidebar('page-sidebar')): ?>
    </div>
    <?php endif; ?>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    [No bumping. If it’s that urgent, consider hiring someone.]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Loop isn't working’ is closed to new replies.