WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] queried posts but need to disable linking on certain ones (3 posts)

  1. coyacreative
    Member
    Posted 2 years ago #

    I have about 50 posts in one category... about 10 of them are also in another category.
    I have them displayed in a grid of thumbnails.

    I am looking to disable the thumbnail linking on only the 10... but am having a hard time finding a starting point. Here is what I have so far....

    <?php $acs->query_posts(array('group_name' => 'People')); ?>
    		<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
    			<div class="grid-item">
    			<a class="popup" href="<?php the_permalink(); ?>"><img src="<?php echo get_post_meta($post->ID, 'grid_thumbnail', true); ?>" /></a>
    			</div>
    
    		<?php endwhile; ?>

    I feel like this might be an IF statement with the has_category function... but I don't know where to start. Any help is appreciated.

    Thanks.

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    http://codex.wordpress.org/Function_Reference/in_category

    example:

    <?php if( !in_category('another-category') ) { ?><a class="popup" href="<?php the_permalink(); ?>"><?php } ?><img src="<?php echo get_post_meta($post->ID, 'grid_thumbnail', true); ?>" /><?php if( !in_category('another_category') ) { ?></a><?php } ?>
  3. coyacreative
    Member
    Posted 2 years ago #

    Awesome! This did the trick.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic