php 'if' 'and'

I hope someone can help. I have 2 custom fields set to identify two different types of content on my website. I wish to display one type of content in one

and the second set of content in a second

I feel this should be achievable. I am using wordpress as the back end of the site. I believe this following section of code should identify which of the custom fields each piece of content has.

[php]<?php if(get_post_meta($post->ID, "type", true) == "offer"){ ?>

<?php if(get_post_meta($post->ID, "type", true) == "coupon"){ ?>[/php]

I also believe the following section of code generates a single

populated with content containing either custom field.

[php]<?php if($GLOBALS['query_total_num'] > 0){?>


<?php echo $GLOBALS['query_total_num']; ?> <?php echo PEC($GLOBALS['_LANG']['_gal1']) ?>

 <div class="itemboxinner nopadding"> 
                
  <ul class="couponlist">
                
   <?php $GLOBALS['query_file']="_item_small.php"; $PPTDesign->GALLERYBLOCK(); ?>
                    
                </ul>
                
            </div>
    </div>
    
</div> 

<?php } ?> [/php]

How would I combine these two code sections so that only content marked with the custom field ‘coupon’ is displayed in the

. I have attempted to combine the first if statement with &&

[php]<?php if($GLOBALS['query_total_num'] > 0) && if(get_post_meta($post->ID, "type", true) == "coupon"){?>{[/php]

and it wont output any content? I guess I should also check that these are the correct areas to be working with too.

Grateful for any help.
Jon
FindVouchersHere

Try:

[php]<?php if($GLOBALS['query_total_num'] > 0 && get_post_meta($post->ID, "type", true) == "coupon"){?>{[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service