WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Pulling post based on more then one parameter (3 posts)

  1. GabyVazquez
    Member
    Posted 4 years ago #

    The code below is part of timthumb, it calls the meta data from the post and if the custom field has "thumb" it will display my thumbnail and link it to the post. I simply want to add an additional parameter that checks which category is linked to the post.

    I tried adding

    && ( in_category( 'sponsored-events' )) but I keep getting a syntac error. I'm not program savy, so please break it down in lames terms

    The the get meta data, and consiquently adding the catagory filter is on the 2nd line of code,

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php if ( get_post_meta($post->ID, 'thumb', true) ) { ?>
    
    <div class="postthumb" style="display:inline; padding:5px;">
    
    <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=100&w=100&zc=1" alt="<?php the_title(); ?>" width="100" height="100" /> </a>
    </div>
    <?php } ?>
    
    <?php endwhile; ?>
  2. MichaelH
    Member
    Posted 4 years ago #

    Figure out the category ID for that category...for example will use 67 for now...

    Then before this line

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    put

    <?php query_posts($query_string . '&cat=-67');?>
  3. GabyVazquez
    Member
    Posted 4 years ago #

    you're the man! worked perfectly

Topic Closed

This topic has been closed to new replies.

About this Topic