• Resolved HorrorUK

    (@horroruk)


    I’m havign some trouble with adding the loop to my page, it gives me a white screen.

    This is the loop I am using:

    <?php $my_query = new WP_Query("showposts=5&cat=18"); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <?php the_post_thumbnail(); ?>
    <a href="<?php the_permalink(); ?>"><H3><?php the_title(); ?></H3></a>
    <br><div class="wp-post-image">

    If I remove the second line, the white screen doesn’t happen, but then it doesn’t work:

    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • try turning on error reporting and see what it says:

    <?php
    ini_set('display_errors',1);
    error_reporting(E_ALL ^ E_NOTICE);
    ?>

    put that at above your current code.

    also you need to have <?php endwhile; ?> somewhere i don’t see it there but it also looks like you didn’t post all the code either.

    Thread Starter HorrorUK

    (@horroruk)

    Thanks, that got it sorted for me ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Loop is causing white screen’ is closed to new replies.