This is my code (So how will i get lowest price from posts)
<div>
it is getting subcategories from parent category
<?php
$subcategories = get_categories('&child_of='.$cat.'&hide_empty');
foreach ($subcategories as $subcategory) {
?>
<div class="cat-con">
<?php
$subCatId=sprintf('%s',$subcategory->term_id); //the_content();
query_posts('cat='.$subCatId.'&order=ASC&meta_key=price&orderby=meta_value_number');
this part of code is getting me price of custom fields
while ( have_posts() ) : the_post();
/************************************************************************/
$price=$post->ID;
$price = get_post_meta($price, 'price', true);
if ($price <= 3500) {
$minPrice=$price;
/************************************************************************/
?>
<div class="cat-img">
<?php $postID=$post->ID; $image = wp_get_attachment_image_src (get_post_thumbnail_id( $pageID ),'medium', true) ; ?>
<img width="445" height="209" src="<?php echo $image[0]; ?>" alt="" />
</div>
<div class="clear"></div>
<div class="cat-heading">
<?php echo sprintf('<a href="%s">%s</a>',get_category_link($subcategory->term_id), apply_filters('get_term', $subcategory->name));?></a>
</div>
<div class="clear"></div>
<div class="cat-con-text">
<p><?php the_content(); ?><p>
</div>
<div class="clear"></div>
<div>
<div class="floatright">
<a href="<?php echo sprintf('%s',get_category_link($subcategory->term_id)); ?>"><img src="<?php bloginfo( 'template_directory' );?>/images/btn-view.png" alt="" /></a>
</div>
<div class="cat-price">Price Start From £<?php echo $minPrice?></div>
<div class="clear"></div>
</div>
<?php
} // end if $price
endwhile; ?>
</div>
<?php } //end foreach; ?>
<div class="clear"></div>
</div>
<!--End Category-->
Assuming you’ll echo
$minPrice
at the bottom (outside of the loop):/************************/