scep2
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Responsive Lightbox & Gallery] ALT Tags Only Show if in WP Gallery@lutzcreativegroup: Thanks a lot. This helped!
Forum: Plugins
In reply to: [BadgeOS] Get achievement post thumbnail with earned/unearned-distinctionHi Michael
Thank you very much. This works like a charm. If someone has the same need, here is the complete code.
CSS
span.unearned_achievement { opacity: .4; }PHP (WordPress-Template)
<?php $posts = get_field('badges'); // This is a custom field generated with the Advanced Custom Fields plugin if( $posts ): ?> <?php $earned_achievements = badgeos_get_user_earned_achievement_ids( get_current_user_id() ); ?> <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?> <?php setup_postdata($post); ?> <a href="<?php echo get_permalink( $post->ID ) ?>" target="_new"> <?php if (in_array($post->ID, $earned_achievements)) { echo badgeos_get_achievement_post_thumbnail( $post->ID ); } else { echo "<span class='unearned_achievement'>"; // This allows for changing opacity with CSS echo badgeos_get_achievement_post_thumbnail( $post->ID ); echo "</span>"; } ?> </a> <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?> <?php endforeach; ?> <?php endif; ?>
Viewing 2 replies - 1 through 2 (of 2 total)