The code needs alot of work, you have lots of opening elements and very little closing….
<li>
has no closing…
<ul>
has no closing…
Lots of <div>
have no closing tags also..
Fix your HTML first, then post back, it’s too confusing right now to determine how the above HTML ‘should’ look…
That’s only stratching the surface to, there’s quite a few places where you’re incorrectly nesting or switching in and out of PHP…
I did make a start tidying, but like i said it really needs the HTML fixed. Without knowing it’s my best guess at how the code should be… this is where i got to before posting, anyone else of course welcome to expand on what i started, though i would suggest you work at getting the HTML correctly formatted and close off any tags that need closing first…
<?php get_header(); ?>
<div class="content">
<ul class="nav">
<li <?php if ( is_home() ) { echo 'class="current-cat"'; } ?>>Recently Added #
<div class="clear"></div>
</li>
</ul>
<?php
if (is_category()) {
$cat_id = get_query_var('cat');
$cats = wp_list_categories('echo=0&title_li=&show_count=0&use_desc_for_title=0&child_of='.$cat_id);
if ( $cats != "# No categories") {
?>
<div class="subnav">
<?php wp_list_categories('title_li=&orderby=name&show_count=0&use_desc_for_title=0&child_of='.$cat_id); ?>
</div>
<?php
} //if $cats != no categories
} //if is category
?>
<div class="main">
<div class="listing">
<div class="head">
<span class="name">Item Name</span>
<span class="price">Price</span>
<span class="location">Location</span>
<span class="date">Post Date</span>
<div class="clear"></div>
</div>
<div class="list">
<?php
$i = 1;
if (have_posts()) :
while (have_posts()) : the_post();
if ($i % 2 == 0) {
$alt = 'class="alt"';
} else {
$alt = 'class="no"';
}
?>
<div <?php echo $alt; ?>>
<?php the_title(); ?>
<span class="image">
<?php
if ( get_option('main_page_img') == "yes" ) { ?>
<div class="main_page_img" style="background: #FFF url(<?php echo get_bloginfo('template_url')."/img_resize.php?width=50&height=50&url=";?>
<?php cp_one_img(get_the_content()); ?>) center no-repeat">
</div>
<?php
} else {
$ii = 1;
foreach((get_the_category()) as $category) {
if ($ii == "1") {
echo "<img src=\"".get_bloginfo('template_url')."/images/category-icons/".get_option("cat$category->cat_ID").".png\" alt=\"$category->cat_name\" title=\"$category->cat_name\" />";
$ii++;
}
}
}
?>
</span>
<span class="name"><?php if ( strlen(get_the_title()) > 30 ) { echo substr(get_the_title(), 0, 30)."..."; } else { the_title(); } ?></span>
<span class="price"><?php echo get_option('currency'); ?><?php cp_price(get_the_content()); ?></span>
<span class="location"><?php cp_location_single(get_the_content()); ?></span>
<span class="date"><?php the_time('F jS, Y'); ?></span>
<div class="clear"></div>
</div>
<?php $i++; unset($alt); ?>
<?php endwhile; ?>
<div class="navigation1">
<div class="navigation2">
<div class="alignleft">
<?php next_posts_link('<img src="'.get_bloginfo('template_url').'/images/back.jpg" alt="Older Entries" />') ?>
</div>
<div class="alignright">
<?php previous_posts_link('<img src="'.get_bloginfo('template_url').'/images/next.jpg" alt="Newer Entries" />') ?>
</div>
</div>
<div style="clear:both;"></div>
</div>
<div style="clear:both;"></div>
<?php endif; ?>