• gtothab

    (@gtothab)


    Hi,

    I’m getting a message saying I’ve misplaced a endwhile but I’ve been over the code a thousand times and I just can’t find where I went wrong. It’s coming from my page.php but as far as I can tell, all my ifs and whiles are properly closed!!! PLEASE HELP ME!!!

    Thx. Here’s the code:

    <?php get_header(); ?>
    
    <?php if (!is_front_page()): ?>
    
    <div id="wrapperinner">
    
    	<div id="mainheading">
    
    		<div id="heading">
    
    			<h2><?php the_title();?></h2>
    
                 <?php /*?><div class="breadcrumb clearfix"><?php if ( get_option( 'ptthemes_breadcrumbs' )) { yoast_breadcrumb('',''); } ?></div><?php */?>
    
    		</div>
    
                    <?php endif; ?>
    
    	</div>
    
    </div>
    
    <div class="wrapper" >
    
      <div class="container_16 clearfix">
    
        <div id="content" class="grid_11">
    
          <div class="content_spacer">
    
            <?php if(have_posts()) : ?>
    
            <?php while(have_posts()) : the_post(); ?>
    
            <?php $pagedesc = get_post_meta($post->ID, 'pagedesc', $single = true); ?>
    
            <div id="post-<?php the_ID(); ?>" >
    
              <div class="entry">
    
                <?php the_content(); ?>
    
              </div>
    
            </div>
    
            <!--/post-->
    
            <?php endwhile; else : ?>
    
            <div class="posts">
    
              <div class="entry-head">
    
                <h2><?php echo get_option('ptthemes_404error_name'); ?></h2>
    
              </div>
    
              <div class="entry-content">
    
                <p><?php echo get_option('ptthemes_404solution_name'); ?></p>
    
              </div>
    
            </div>
    
            <?php endif; ?>
    
          </div>
    
    <?php if (is_front_page()): ?>    
    
        <div id="content-bottom">
    	<?php query_posts('showposts=1&offset=0&cat=26'); ?>
            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        	<div id="news-block" class="clearfix home-block-wrap">
                    <h3 class="home-block-sec-title"><?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?></h3>
    		<?php $news_thumb = get_post_meta($post->ID, 'news-image', true); ?>
                    <?php if($news_thumb != '') { ?>
                    <div class="home-block-thumb">
                            <a href="<?php the_permalink() ?>"><img src="<?php echo get_post_meta($post->ID,  'news-image', true); ?>" title="<?php the_title(); ?> image" alt="Scrapbook Gallery, Puerto Rico scrapbook suplies" width="150" height="150" /></a>
                    </div><!-- home-block-thumb -->
    		<?php } ?>
            	<h4 class="home-block-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
            	<div class="home-block-content">
    			<?php $news_excerpt = get_the_excerpt();
                            if($news_excerpt != ''){
            		the_excerpt();
    			}
    				else {
    					the_content();
    				}
    			?>
           		 </div><!-- home-block-content -->     
    
            </div><!-- news block --> 
    
            <?php endwhile; endif; ?>
    
            	<?php query_posts('showposts=1&offset=0&cat=21'); ?>
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
            	<div id="prod-nuevo-block" class="clearfix home-block-wrap">
                    	<div class="home-block-thumb">
                                    <a href="<?php foreach((get_the_category()) as $category) { echo $category->slug . ' '; ?>"><img src="<?php echo get_post_meta($post->ID, 'large-image', true); ?>" title="<?php the_title(); ?> image" alt="Image of <?php the_title(); ?> by Scrapbook Gallery, Puerto Rico scrapbook suplies" width="150" height="150" /></a>
                            </div><!-- home-block-thumb -->
                    <h4 class="home-block-title">
                            <a href="<?php foreach((get_the_category()) as $category) { echo $category->slug . ' '; } ?>"><?php the_title(); ?></a></h4><!-- home-block-title -->
                    <div class="home-block-content">
    			<?php $prod_excerpt = get_the_excerpt(); 
    
    			if($prod_excerpt != ''){
    				the_excerpt();
    			}
    				else {
    					the_content();
    				}
    			?>
           	 </div><!--home-block-content -->
        </div> <!--prod-nuevo-block -->
            <?php endwhile; endif; ?>
    
            	<?php query_posts('showposts=1&offset=0&cat=28'); ?>
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
            	<div id="cliente-mes-block" class="clearfix home-block-wrap">
                    <h3 class="home-block-sec-title"><?php foreach((get_the_category()) as $category) { echo $category->cat_name . ' '; } ?></h3>
    
                    	<div class="home-block-thumb">
                            <a href="<?php foreach((get_the_category()) as $category) { echo $category->slug . ' ';  ?>">
    <img src="<?php echo get_post_meta($post->ID, 'client-image', true); ?>" title="<?php the_title(); ?> image" alt="Image of <?php the_title(); ?> by Scrapbook Gallery, Puerto Rico scrapbook suplies" width="150" height="150" /></a>
    			</div><!-- home-block-thumb -->
                            <h4 class="home-block-title"><a href="<?php foreach((get_the_category()) as $category) { echo $category->slug . ' '; }?>"><?php the_title(); ?></a></h4><!-- new-product-title -->
    
            		<div class="home-block-content">
    				<?php $client_excerpt = get_the_excerpt(); ?>
                                    <?php if(!$client_excerpt == ''){ ?>
                                    <?php the_excerpt();
                                    }
                                            else {
                                                    the_content();
                                            }
                                    ?>
            </div><!-- home-block-content -->
    
        </div>        
    
            <?php endwhile; endif; ?>
    
        </div><!-- content-bottom -->
            <?php endif; ?>
    
       <?php get_sidebar('menu'); ?>
    
       <?php get_sidebar(); ?>
    
    </div>
    
    <!-- wrapper #end -->
    
    <?php get_footer(); ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael

    (@alchymyth)

    double-check all the ‘foreach’ loops

    I think I might have found the problem. In your section that begins with

    <?php query_posts('showposts=1&offset=0&cat=21'); ?>

    there is no closing bracket for your foreach loop in the anchor link. Add the closing bracket, and see whether that clears up the problem.

    Same thing with the section that starts with

    <?php query_posts('showposts=1&offset=0&cat=28'); ?>

    Thread Starter gtothab

    (@gtothab)

    jPry:

    Awesome! That did it!

    Thanks for the help. Super pumped to get that straightened out.

    GtothaB

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Whatsup with this?? : syntax error, unexpected T_ENDWHILE’ is closed to new replies.