Parse Error: Unexpected '}'

Discussion in 'PHP' started by c.Payne, Jul 30, 2011.

  1. #1
    I'm trying to make a featured posts banner with the title of the posts hovering over thumbnail sized images. Unfortunately, I'm getting a very annoying parse error:
    Line 230 is the very last line.

    Here's the code snippet:

    //Main Banner
    function main_banner() {
    add_image_size('mycustomsize', 240, 160, true);
    $my_query = new WP_Query('category_name=featured&showposts=4'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID;
    echo '<ul id="review-banner">';
              echo '<li style="background: url(';
    		  the_post_thumbnail('mycustomsize');
    		  echo ') no-repeat;"><h2><a href="URLToAPost">PostTitle</a></h2></li>';
    		  echo '<li style="background: url(';
    		  the_post_thumbnail('mycustomsize');
    		  echo ') no-repeat;"><h2><a href="URLToAPost">PostTitle2</a></h2></li>';
              echo '<li style="background: url(';
    		  the_post_thumbnail('mycustomsize');
    		  echo ') no-repeat;"><h2><a href="URLToAPost">PostTitle3</a></h2></li>';
              echo '<li class="review-banner-last" style="background: url(';
    		  the_post_thumbnail('mycustomsize');
    		  echo ') no-repeat;"><h2><a href="URLToAPost">PostTitle4</a></h2></li>';
    echo '</ul>'; 
    }
    PHP:
    Any help would be greatly appreciated.
     
    c.Payne, Jul 30, 2011 IP
  2. bogi

    bogi Well-Known Member

    Messages:
    482
    Likes Received:
    16
    Best Answers:
    2
    Trophy Points:
    140
    #2
    You didn't close the while loop.

    
    //Main Banner
    function main_banner() {
    add_image_size('mycustomsize', 240, 160, true);
    $my_query = new WP_Query('category_name=featured&showposts=4'); 
    
    while ($my_query->have_posts()) : 
    
    	$my_query->the_post(); 
    	$do_not_duplicate = $post->ID;
    	echo '<ul id="review-banner">';
    	echo '<li style="background: url(';
    	the_post_thumbnail('mycustomsize');
    	echo ') no-repeat;"><h2><a href="URLToAPost">PostTitle</a></h2></li>';
    	echo '<li style="background: url(';
    	the_post_thumbnail('mycustomsize');
    	echo ') no-repeat;"><h2><a href="URLToAPost">PostTitle2</a></h2></li>';
    	echo '<li style="background: url(';
    	the_post_thumbnail('mycustomsize');
    	echo ') no-repeat;"><h2><a href="URLToAPost">PostTitle3</a></h2></li>';
    	echo '<li class="review-banner-last" style="background: url(';
    	the_post_thumbnail('mycustomsize');
    	echo ') no-repeat;"><h2><a href="URLToAPost">PostTitle4</a></h2></li>';
    	echo '</ul>';
    endwhile;
    }
    
    PHP:
     
    bogi, Jul 30, 2011 IP
  3. c.Payne

    c.Payne Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Wow.... I just smacked myself over the head. Thanks.
     
    c.Payne, Jul 30, 2011 IP