• Resolved wpmhweb

    (@wppit)


    Hello,

    I am getting random blank pages and sometimes Internal server error with WordPress, could anyone tell me if the following code is OK?

    Thanks,

    <?php
        $recentPosts = new WP_Query();
        $recentPosts->query('showposts=2')
    	;?>
    
    <?php $count = 0; ?>
    
    <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
       <!-- do some stuff here -->
    
                    <?php $count++; ?>
    
                    <?php if ($count == 1) : ?>
    
    	<div id="post-<?php the_ID(); ?>" class="onegrd">
    
                <a href="<?php the_permalink() ?>" rel="bookmark" class="big-link"></a>
    
                <div class="feature-meta">
    
        <h2><a href="<?php the_permalink() ?>" ><?php the_title(); ?></a></h2>
        <p style="color:#fff; line-height: 15px;"><?php custom_excerpt(250); ?></p>
    
        </div>
    
                    <div class="image-window shadowbox" style="width: 339px; height: 288px;">
                    <a style="position: absolute; width: 684px; height: 100%; overflow:hidden; left: -150px;" href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail('large'); ?></a>
    
    						</div>
    
        	</div>
    
            <?php elseif ($count == 2) : ?>
    
            <div iid="post-<?php the_ID(); ?>" class="twogrd featured2">
    
            			<a href="<?php the_permalink() ?>" rel="bookmark" class="big-link"></a>
    
                <div class="feature-meta-smaller">
    
        <h2><a style="line-height: 28px!important; font-size:30px!important;" href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
        <?php /*?><p style="color:#fff; line-height: 15px;"><?php custom_excerpt(140); ?></p><?php */?>
    
        </div>
    
                    <div class="image-window shadowbox">
                    <a style="position: absolute; overflow:hidden; width: 150%; height: auto;" href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail('large'); ?></a>
    
    						</div>
    
            		</div>
     <?php endif; ?>
    
                   <?php endwhile; ?>

    What I am trying to do here is to customize each post differently in the in a custom homepage.

    Thanks,

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘I am having server errors, so I'm wondering if this code is OK?’ is closed to new replies.