WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I get a white page in the frontend (not in the backend) after inserting the php code for the custom post type. See code: page-custom.php:

<div class="infoboxen">
 <div class="box">
<?php $loop = new WP_Query( array( 'post_type' => 'drei_boxen', 'posts_per_page' => 10 ) ); ?>

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


add_action( 'init', 'create_my_post_types' );

function create_my_post_types() {
register_post_type( 'infobox', 
        'labels' => array(
            'name' => __( 'Infoboxen' ),
            'singular_name' => __( 'Infoboxen' ),
            'description' => __('Zur Erstellung der vier Boxen auf der Startseite unterhalb des Sliders')
        'public' => true,


Any ideas why? If I delete the code from the page-custom.php it works. But with the code, I only get a white page and white source code.

share|improve this question

closed as too localized by Brian Fegter, kaiser, Rarst Oct 1 '12 at 19:37

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Is the code above all that you've placed inside your template? If so, this is a PHP syntax error that's causing the white screen. If not, please post more code. Thanks – Brian Fegter Sep 14 '12 at 3:56
Please read about debugging in WP Codex. Whitescreen = no debug turned on. – kaiser Sep 23 '12 at 15:08
up vote 0 down vote accepted

You forgot about endwhile; at the end of loop.

Using template don't forget to get_header() and get_footer()


  Template Name: Test

<?php get_header(); ?>

<div class="infoboxen">
    <div class="box">
        <?php $loop = new WP_Query(array('post_type' => 'drei_boxen', 'posts_per_page' => 10)); ?>

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

<?php get_footer(); ?>
share|improve this answer
oh..right. THANKS a lot. (there was no header and footer, because i just copied a part of the whole document) but thanks! saved my day! – max Aug 24 '12 at 11:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.