Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///Repeater – Only Display First 3 Rows///
- --------------------------------------
- <?php
- if( have_rows('latest_offers', 'options') ):
- $i = 0;
- while ( have_rows('latest_offers', 'options') ) : the_row(); ?>
- <?php $i++; ?>
- <?php if( $i > 3 ):
- <?php break; ?>
- <?php endif; ?>
- <a href="<?php the_sub_field('page_link'); ?>" class="hot">
- <div class="img"><img src="<?php the_sub_field('brand_logo'); ?>" alt=""></div>
- <div class="text">
- <div class="smlltxt"><?php the_sub_field('heading'); ?></div>
- <div class="num"><?php the_sub_field('price'); ?></div>
- <div class="txt"><?php the_sub_field('description'); ?></div>
- </div>
- <img src="<?php echo get_template_directory_uri(); ?>/img/hot.png" alt="" class="hot_img">
- </a>
- <?php endwhile;
- endif;?>
- //Repeater field content into Group field
- ----------------------------------------------
- <?php if( have_rows('installation_option_area', 'option') ):
- while( have_rows('installation_option_area', 'option') ): the_row(); ?>
- <div class="comon_black_title fix">
- <h1><?php the_sub_field('installation_option_title'); ?></h1>
- </div>
- <div class="instal_optios_wrapper fix">
- <?php if( have_rows('installation_option_item_area') ): ?>
- <?php while( have_rows('installation_option_item_area') ): the_row(); ?>
- <div class="col-md-4 col-sm-4">
- <div class="instal_optios_item fix">
- <a href="<?php the_sub_field('item_link'); ?>">
- <div class="instal_optios_thumb fix">
- <img src="<?php the_sub_field('item_image'); ?>" alt="">
- </div>
- </a>
- <div class="instal_optios_text fix">
- <h4><?php the_sub_field('item_title'); ?></h4>
- <p><?php the_sub_field('item_textarea'); ?> </p>
- </div>
- </div>
- </div>
- <?php endwhile; endif; ?>
- </div>
- <?php endwhile; endif; ?>
- //Unique ID for Repeater Field
- <?php if(get_field('repeater_field_name')): $i = 0; ?>
- <ul>
- <?php while(has_sub_field('repeater_field_name')): $i++; ?>
- <li class="section-<?php echo $i; ?>">
- sub_field_1 = <?php the_sub_field('sub_field_1'); ?>, sub_field_2 = <?php the_sub_field('sub_field_2'); ?>, etc
- </li>
- <?php endwhile; ?>
- </ul>
- <?php endif; ?>
- // acf gallery into repeater with fancybox lightbox dynamic code
- =============================================================
- <?php if( have_rows('package_sidebar_galley') ): ?>
- <div class="packge_extens_content_galeryrht fix">
- <?php $gallery_count=1;
- while( have_rows('package_sidebar_galley') ): the_row();
- ?>
- <div class="packge_extens_galeryrht_single fix">
- <?php
- $images = get_sub_field('sidebar_gallery');
- $img_count=1;
- if( $images ): ?>
- <?php
- foreach( $images as $image ):
- if ($img_count == 1) { ?>
- <img src="<?php echo $image['url']; ?>" alt="" />
- <a rel="gallery<?php echo $gallery_count;?>" class="more_galtext various_popup" href="<?php echo $image['url']; ?>">More Package Photos</a>
- <?php }else {?>
- <a rel="gallery<?php echo $gallery_count;?>" class="various_popup" href="<?php echo $image['url']; ?>"></a>
- <?php }
- $img_count++;
- endforeach;
- endif;
- ?>
- </div>
- <?php
- $gallery_count++;
- endwhile; ?>
- </div>
- <?php endif; ?>
- // post object display code if not work acf example code
- ========================================================
- <?php $post_objects = get_field('house_fleet_title'); ?>
- <p><a href="<?php echo get_permalink($post_objects->ID); ?>"><?php echo get_the_title($post_objects->ID); ?></a></p>
- // Display the First image from gallery
- ==========================================
- <?php $images = get_field('image_for_light_box');
- if( $images ): $image_1 = $images[0]; ?>
- <a class="install_fancybox" rel="prettyPhoto[ins_gal<?php the_ID(); ?>]" href="<?php echo $image_1['url']; ?>" >
- <img src="<?php echo $image_1['sizes']['medium']; ?>" alt="" />
- </a>
- <?php endif; ?>
- // Exclude the First image from gallery
- =======================================
- <?php $gallimages = get_field('image_for_light_box');
- for ($i=0; $i<1; $i++){
- if (!empty($gallimages)) {
- $remove = array_shift($gallimages);
- }
- }
- if( $gallimages ): ?>
- <div class="install_gallthumb_small">
- <?php foreach( $gallimages as $gimage ): ?>
- <div class="gallthumb_small_single">
- <a class="install_fancybox" rel="prettyPhoto[ins_gal<?php the_ID(); ?>]" href="<?php echo $gimage['url']; ?>" >
- <img src="<?php echo $gimage['sizes']['thumbnail']; ?>" alt="" />
- </a>
- </div>
- <?php endforeach; ?>
- </div>
- <?php endif; ?>
- or if you want to skip couple of item then mention how many as a example for skip first 4 item
- -----------------------------------------------------------------------
- for ($i=0; $i<4; $i++){
- if (!empty($gallimages)) {
- $remove = array_shift($gallimages);
- }
- }
- // display acf field item on wocommerce category page.
- -------------------------------------------------
- <?php $queriedObject = get_queried_object();
- $category_image = get_field('category_image','product_cat_'.$queriedObject->term_id);?>
- <?php if($category_image) :?>
- <div class="catalog_top_images_new row">
- <img src="<?php echo $category_image;?>" alt="" />
- </div>
- <?php endif; ?>
- //combine meta value for wp query acf repeater field
- function my_posts_where( $where ) {
- global $wpdb;
- $where = str_replace(
- "meta_key = 'feature_latest_list_%",
- "meta_key LIKE 'feature_latest_list_%",
- $wpdb->remove_placeholder_escape($where)
- );
- return $where;
- }
- add_filter('posts_where', 'my_posts_where');
- // show all checkbox label and value
- <?php $my_post = new WP_Query(array(
- 'post_type' => 'programs-items',
- ));
- if($my_post -> have_posts()):
- while($my_post -> have_posts()): $my_post -> the_post();
- $values = get_field('diagonostic');
- $field = get_field_object('diagonostic');
- $choices = $field['choices'];
- foreach ($choices as $value => $label) {
- echo '<option value="' . $value . '">' . $label. '</option>';
- }
- ?>
- <?php endwhile; endif; wp_reset_query(); ?>
- // display random display with ACF repeater content
- <?php $testimonial = get_field( 'testimonial_area' ); ?>
- <?php if( is_array( $testimonial ) ) { ?>
- <?php $testi = array_rand( $testimonial ); ?>
- <div class="testimonial_content fix">
- <div class="testimonial_textquote">
- <h4><?php echo $testimonial[$testi]['testimonial_quote'];?> </h4>
- </div>
- <div class="testimonial_logoicon">
- <img src="<?php echo $testimonial[$testi]['testimonial_image'];?> " alt="">
- </div>
- <div class="testimonial_title">
- <h3><?php echo $testimonial[$testi]['testimonial_name'];?> </h3>
- </div>
- <div class="testimonial_position">
- <h4><?php echo $testimonial[$testi]['testimonial_position'];?> </h4>
- </div>
- </div>
- <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment