Support » Fixing WordPress » Pulling post based on more then one parameter

  • Resolved GabyVazquez

    (@gabyvazquez)


    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; ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • 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');?>

    you’re the man! worked perfectly

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pulling post based on more then one parameter’ is closed to new replies.