开发者

Wordpress Loop - Top 4 posts have different structure (PHP ERROR)

Hey, I'm not so great with PHP, pretty novice. But this flags up an error.

<?php if ( have_posts() ) : while ( have_posts() ) : the_post();  
                  $loopcounter++; ?> 

            <?php if ($loopcounter  == 1) { ?>
                <section class="post" class="postFeatured">
                <h1 class="post"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
            <?php } else { ?>
                <section class="post" class="postSmall">
                <h2 class="post"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
            <?php } ?>

                    <div class="image">
                        <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" class="imgHolder">
                            <div class="img">
                                <div class="cc"><span class="number"><?php comments_number('0', '1', '%'); ?></span><span class="txt">COMMENTS</span></div>
                                <?php $image = get_post_meta($post->ID, 'image', true); ?>
                                <img src="<?php echo $image; ?>" alt="<?php the_permalink() ?>" />
                            </div>
                        </a>
                    </div>

                    <ul class="postDetail">
                        <li class="dateAuth">
                            <div class="dMY"><?php the_time('d M Y') ?></div>
                            <div class="author">Posted by <?php the_author_posts_link() ?></div>
                        </li>
 开发者_运维技巧                       <li class="categories">
                            <div class="cats"><?php the_category(', ') ?></div>
                        </li>
                    </ul>

                    <div class="entry excerpt">
                        <?php the_excerpt(); ?>
                        <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>" class="read-more">Read Article</a>
                    </div>

                </section>
            <?php } endwhile; endif; ?>

Not sure why, can anyone help me?

REDUCED

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post();  
      $loopcounter++; ?> 
        <div class="post">
<?php if ($loopcounter  == 1) { ?>
         <h1 class="first"><?php the_title(); ?></h1>
<?php } else { ?>
         <h1 class="second"><?php the_title(); ?></h1>
<?php } ?>
        <?php the_content(); ?>
        </div>
<?php } endwhile; endif; ?>

Error ends up being: <?php } endwhile; endif; ?>


Lose the closing brace preceding the endwhile.

Also, the endif is redundant.


The last curly brace before the endwhile does not match any opening curly brace.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜