Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Tags in class=""

Discussion in 'Troubleshooting & How-To's' started by StevendeJong, May 5, 2014.

  1. StevendeJong

    New Member

    May 5, 2014
    Likes Received:
    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>
    <?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.

Share This Page

Monarch Social Sharing Plugin