0

This is both my first time messing with a Wordpress Template and my first time using PHP (save for the occasional server include). Which is to say, I no nothing of PHP and only barely have a grasp on the syntax.

I'm trying to create some customized loops and once I got one to work, I simply copy pasted the working code, changed the ID's, and expected that to work. Silly maybe? Anyhow, I'm getting an unexpected $end on line 203.

Anyone willing to tell me what's causing that? Thanks in advance!

<!-- FEATURED LOOP -->
<div class="featured">
<?php $my_query = new WP_Query('category_name=featured&showposts=1'); ?>
<?php if ( have_posts() ) : ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

        <?php do_atomic( 'before_entry' ); // origin_before_entry ?>

        <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
            <?php do_atomic( 'open_entry' ); // origin_open_entry ?>

            <?php
            if ( current_theme_supports( 'get-the-image' ) ) {                              
                if ( is_sticky ( $post->ID ) ) {
                    get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'single-thumbnail', 'image_class' => 'featured' ) );
                } else {
                    get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'thumbnail', 'image_class' => 'featured' ) );
                }
            }
            ?>

            <div class="sticky-header">
                <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
                <?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[entry-published] &middot; by [entry-author] &middot; in [entry-terms taxonomy="category" before=""] [entry-edit-link before=" &middot; "]', 'origin' ) . '</div>' ); ?>                 
            </div><!-- .sticky-header -->

            <div class="entry-summary">
                <?php the_excerpt(); ?>
                <?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'origin' ), 'after' => '</p>' ) ); ?>
            </div><!-- .entry-summary -->

            <?php do_atomic( 'close_entry' ); // origin_close_entry ?>
        </div><!-- .hentry -->

        <?php do_atomic( 'after_entry' ); // origin_after_entry ?>

    <?php endwhile; ?>
    <?php wp_reset_postdata(); // reset the query ?>
<?php else : ?>
<!--END FEATURED LOOP-->    

<!-- SUBFEATURED LOOP -->
<div class="subfeatured">
<?php $my_query = new WP_Query('category_name=subfeatured&showposts=1'); ?>
<?php if ( have_posts() ) : ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

        <?php do_atomic( 'before_entry' ); // origin_before_entry ?>

        <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
            <?php do_atomic( 'open_entry' ); // origin_open_entry ?>

            <?php
                if ( current_theme_supports( 'get-the-image' ) ) {
                    if ( is_sticky ( $post->ID ) ) {
                        get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'single-thumbnail', 'image_class' => 'featured' ) );
                    } else {
                        get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'thumbnail', 'image_class' => 'featured' ) );
                    }
                }
            ?>

            <div class="sticky-header">
                <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
                <?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[entry-published] &middot; by [entry-author] &middot; in [entry-terms taxonomy="category" before=""] [entry-edit-link before=" &middot; "]', 'origin' ) . '</div>' ); ?>
            </div><!-- .sticky-header -->

            <div class="entry-summary">
                <?php the_excerpt(); ?>
                <?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'origin' ), 'after' => '</p>' ) ); ?>
            </div><!-- .entry-summary -->

            <?php do_atomic( 'close_entry' ); // origin_close_entry ?>
        </div><!-- .hentry -->

        <?php do_atomic( 'after_entry' ); // origin_after_entry ?>

    <?php endwhile; ?>  
    <?php wp_reset_postdata(); // reset the query ?>
<?php else : ?>         
<!--END SUBFEATURED LOOP-->
3
  • Usually that error indicates that you're missing the closing of a loop (for, foreach, while, if). Can you check before/after line 203 to see if that is the case? It's a bit difficult to sort through it all, without the line numbers. Commented May 17, 2012 at 17:56
  • 2
    Vote to close as Too Localized. It's easy to tell what that error means from the 4,000+ other questions. You have a mis-matched control structure somewhere. Commented May 17, 2012 at 18:04
  • If you replace both of the <?php else : ?> lines in the code with <?php endif; ?> you should be good to go. Commented May 17, 2012 at 18:06

1 Answer 1

2

The last line of php code you have is:

   <?php else : ?>

You need to complete that control structure. You are missing something like:

   <?php endif; ?>
Sign up to request clarification or add additional context in comments.

1 Comment

Found it! Sorry about the naiveté of this question, Php fries my non-developer brain. Many thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.