• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Parse error: syntax error, unexpected 'else' (T_ELSE) in E:\Work Data\Sites\Portfolio
#1
Code:
<?php

get_header();
?>

<!-- PORTFOLIO AREA -->
    <section>
    <hr class="no-margin" />
<?php
    wp_nav_menu(array(
    'theme_location' => 'category-menu',
    'container' => '',
    'menu_class' => 'inline align-center portfolio-header',
    'menu_id' => 'portfolio-sorting'
    ));
?>

<div class="middle-container section-content">
    <div class="container">
<?php if (have_posts()) : ?>
    <ul class="row portfolio-entries">
<?php while(have_posts()) : the_post(); ?>
<li class="span4 box portfolio-entry">
    <div class="hover-state align-right">
<p><?php the_title(); ?></p>
    <em>Click to see project</em>
    <!-- end hover-state -->
    </div>
<?php if (has_post_thumbnail()) : ?>
    <figure>
    <a href="<?php the_permalink(); ?>">
    <?php the_post_thumbnail(); ?>
    </a>
    </figure>
    <?php endif; ?>
    </li>
    <? endwhile; ?>
    </ul>

    <?php else: ?>
    <div class="middle-container section-content">
    <div class="container box section-content align-center"><h2>No posts were found.</h2>
<!-- end container -->
</div>
<!--  end middle-container -->
</div>
<?php endif; ?>

<div class="box align-center portfolio-nav">
<ul class="inline">
<li><a href="#" class="btn">&larr; Previous Page</a></li>
<li><a href="#" class="btn">Next Page &rarr;</a></li>
</ul>
<!-- end cta -->
</div>
<!-- end container -->
</div>
<!--  end middle-container -->
</div>
<!-- End Portfolio Area -->
</section>

<?php get_footer();


?>
I'm trying to learn the Wordpress Theme Development and I'm new/fresh in coding of PHP and Wordpress for now I'm just trying to understand the coding of PHP and how to develop Wordpress theme. During a Wordpress theme I am getting the error line given in the title bar and I am unable to understand why I'm getting this error ..?

Any help please.. ??
  Reply
#2
You used this line in your code i wrote below
Code:
<? endwhile; ?>
Instead of 
Code:
<?php endwhile; ?>
The first one may not work if  short_open_tag if your php.ini is not set.
 i have made changes try this now 
Code:
<?php

get_header();
?>

<!-- PORTFOLIO AREA -->
    <section>
    <hr class="no-margin" />
<?php
    wp_nav_menu(array(
    'theme_location' => 'category-menu',
    'container' => '',
    'menu_class' => 'inline align-center portfolio-header',
    'menu_id' => 'portfolio-sorting'
    ));
?>

<div class="middle-container section-content">
    <div class="container">
<?php if (have_posts()) : ?>
    <ul class="row portfolio-entries">
<?php while(have_posts()) : the_post(); ?>
<li class="span4 box portfolio-entry">
    <div class="hover-state align-right">
<p><?php the_title(); ?></p>
    <em>Click to see project</em>
    <!-- end hover-state -->
    </div>
<?php if (has_post_thumbnail()) : ?>
    <figure>
    <a href="<?php the_permalink(); ?>">
    <?php the_post_thumbnail(); ?>
    </a>
    </figure>
    <?php endif; ?>
    </li>
    <?php endwhile; ?>
    </ul>

    <?php else: ?>
    <div class="middle-container section-content">
    <div class="container box section-content align-center"><h2>No posts were found.</h2>
<!-- end container -->
</div>
<!--  end middle-container -->
</div>
<?php endif; ?>

<div class="box align-center portfolio-nav">
<ul class="inline">
<li><a href="#" class="btn">&larr; Previous Page</a></li>
<li><a href="#" class="btn">Next Page &rarr;</a></li>
</ul>
<!-- end cta -->
</div>
<!-- end container -->
</div>
<!--  end middle-container -->
</div>
<!-- End Portfolio Area -->
</section>

<?php get_footer();


?>

Hope it works for You.
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)