M
M
mr_dev1l2016-03-10 13:34:07
JavaScript
mr_dev1l, 2016-03-10 13:34:07

How to give different attributes to elements in an array?

Good afternoon. I display an array of entries on the WP page, there is a photo gallery in the array. The problem is that all photos are combined into one gallery (lightbox) by default. How to make it easier to make each post's photo gallery have its own group: group1, group2, and so on.

<?php foreach ($posts as $post) : setup_postdata ($post); ?>
                <div style="clear:both;"></div>
                  <li id="action_one_item" class="action-one-item">
                      <ul class="port_tab">
                        <li class="photo_tab">Фотоотчет</li>
       										<li class="video_tab">Видеометариалы</li>
                      </ul>
                        <div class="for_photo"><?php echo get_post_meta($post->ID, 'photo_portfolio', true); ?></div>
                        <div class="for_video"><?php echo get_post_meta($post->ID, 'video_portfolio', true); ?></div>
                        <div class="action_one_item_content"> <?php the_content(); ?> </div>
                  </li>

                <?php endforeach; ?>

Each li has a div with the class for_photo, it is the links inside this div that need to be given different groups.
Thanks in advance

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question