Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //set condition for add Class first item
- ---------------------------------
- <?php $ctr = 0;
- while ( $items->have_posts() ) : $items->the_post();
- $class = $ctr == 0 ? ' active' : '';?>
- <?php echo $class; ?>
- <?php $ctr++;
- endwhile; ?>
- or
- <?php if($id === 0): ?> active<?php endif; ?>
- //set condition for even post item
- --------------------------------------
- <?php $idfst=0;
- if( have_rows('linha_de_produtos_content_area') ):
- while ( have_rows('linha_de_produtos_content_area') ) : the_row();
- if($idfst % 2 == 0) { ?>
- // your single item code here for even post show
- <?php } $idfst++; endwhile; endif; ?>
- //set condition for Odd post item
- ---------------------------------
- <?php $idfst=1;
- if( have_rows('linha_de_produtos_content_area') ):
- while ( have_rows('linha_de_produtos_content_area') ) : the_row();
- if($idfst % 2 == 0) { ?>
- // your single item code here for Odd post show
- <?php } $idfst++; endwhile; endif; ?>
- //set condition for even and Odd post item
- ---------------------------------
- $count_posts = wp_count_posts();
- $published_posts = $count_posts->publish;
- if($published_posts % 2 == 0)
- {
- // even
- }
- else
- {
- //odd
- }
Advertisement
Add Comment
Please, Sign In to add comment