• I made a special template based on the index.php of the execel theme. However, it is not working and I don’t know why.

    the full error is Parse error: syntax error, unexpected T_ELSE line 50 which is the ELSE line. I need that else in order for the template to look right.

    Here is the code.

    <?php get_header(); ?>
    
    <?php
    $temp = $wp_query;
    $wp_query= null;
    $wp_query = new WP_Query();
    $wp_query->query('cat=6&showposts=3'.'&paged='.$paged);
    ?>
    
    <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <?php while (have_posts()) : the_post(); ?>
    			<ul class="pmeta">
    				<li>Posted by <?php the_author() ?></li>
    				<li>On <?php the_time('F j, Y') ?></li>
    				<li><br /><?php the_category(', ') ?></li>
    				<?php if (function_exists('the_tags')) { the_tags('<li>Tags ', '</li>'); } ?>
    				<li><br /><?php comments_popup_link('No Comments', '1 Comment', '% Comments' );?></li>
    				<?php edit_post_link('Edit', '<li>', '</li>'); ?>
    			</ul>
    			<div class="apost">
    				<h2 id="post-<?php the_ID(); ?>">
    <?php if (function_exists('get_cat_icon')) get_cat_icon('small=false'); ?><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
    				<div class="pmain">
    					<!-- spost -->
    
    <?php the_content('Read more...'); ?>
    
    					<!-- epost -->
    				</div>
    <?php if ($count==1) { ?>
    
    <!-- PLACE YOUR 468x60 ADSENSE CODE (OR BANNER) BELOW -->
    
    <!-- PLACE YOUR 468x60 ADSENSE CODE (OR BANNER) ABOVE -->
    
    <?php } ?>
    <?php $count = $count + 1; ?>
    
    			</div>
    
    			<div class="extra"></div>
    <?php endwhile; ?>
    
    			<div class="lead">
    				<span class="ppre"><?php next_posts_link('&laquo; Previous Posts') ?></span>
    				<span class="pnex"><?php previous_posts_link('Next Posts &raquo;') ?></span>
    			</div>
    <?php else : ?>
    			<div class="apost">
    				<h2 class="subh">Oops!</h2>
    				<p class="nopost">Sorry, but you are looking for something that isn't here.</p>
    			</div>
    <?php endif; ?>
    		</div>
    	</div>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

Viewing 1 replies (of 1 total)
  • you use curlies to contain the ‘if’ conditional, but you’re using the alternate syntax with a colon, on the else.

    punctuation is important.

    remove the curlies and put a : after your if.

Viewing 1 replies (of 1 total)
  • The topic ‘unexpected T_ELSE in custom template code’ is closed to new replies.