Wordpress Tags in class
-
07-11-2019 - |
Question
I have added tags to my Custom Post Type. Now I want to use them to create a isotope portfolio, I can load all tags with this code:
<?php $args = array( 'post_type' => 'portfolio', 'posts_per_page' => 24;
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="all <?php echo $tag->slug; ?>">
<?php echo the_post_thumbnail(); ?>
<p><?php the_title(); ?></p>
</div>
<?php endwhile; ?>
But now I want to add the all tags that from each portfolio item to the class=""
.
With <div class="<?php $tag->slug; ?>">
I just get the last tag of all the tags that are used.
I know there are already a lot of posts about this problem, but every post I have found does not seem to work for me.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange