function reference_cell_content_callback($cell_settings) { ob_start(); ?> <?php // Display a single field ?> <p> <?php the_ddl_field('text_data'); // Get the value of the text field using the 'text_data' key. ?> </p> <?php // Display repeatable fields ?> <?php if (has_ddl_repeater('gallery')) { ?> <ul class="thumbnails"> <?php // It looks very similar to the native WordPress Loop, which you're already familiar with ?> <?php while (has_ddl_repeater('gallery')) { the_ddl_repeater('gallery'); ?> <li> <a href="#" class="thumbnail"> <?php // use the_ddl_sub_field('field-name') to display the field value or get_ddl_sub_field('field-name') to asign it to a variable ?> <img src="<?php the_ddl_sub_field('gallery_item'); ?> " alt="<?php _e('Image:', 'theme-context'); ?> <?php the_ddl_repeater_index(); // the_ddl_repeater_index() displays the loop index ?> "> </a> </li> <?php } ?> </ul> <?php } ?> <?php return ob_get_clean(); }
function slider_cell_content_callback() { $unique_id = uniqid(); $pause = ''; if (get_ddl_field('pause')) { $pause = 'data-pause="hover"'; } else { $pause = 'data-pause="false"'; } ob_start(); ?> <?php if (get_ddl_field('autoplay')) { ?> <script> jQuery(document).ready( function($) { var ddl_slider_id_string = "#slider-<?php echo $unique_id; ?> "; $(ddl_slider_id_string).carousel({ interval : <?php the_ddl_field('interval'); ?> <?php if (!get_ddl_field('pause')) { echo ', pause: "false"'; } ?> }); }); </script> <?php } ?> <style> #slider-<?php echo $unique_id; ?> .carousel-inner > .item { height: <?php the_ddl_field('slider_height'); ?> px; } </style> <div id="slider-<?php echo $unique_id; ?> " class="carousel slide ddl-slider" <?php echo $pause; ?> data-interval="<?php the_ddl_field('interval'); ?> "> <ol class="carousel-indicators"> <?php while (has_ddl_repeater('slider')) { the_ddl_repeater('slider'); ?> <li data-target="#slider-<?php echo $unique_id; ?> " data-slide-to="<?php the_ddl_repeater_index(); ?> " <?php if (get_ddl_repeater_index() == 0) { echo ' class="active"'; } ?> ></li> <?php } ddl_rewind_repeater('slider'); ?> </ol> <div class="carousel-inner"> <?php while (has_ddl_repeater('slider')) { the_ddl_repeater('slider'); ?> <div class="item <?php if (get_ddl_repeater_index() == 0) { echo ' active'; } ?> " <?php // Cover image to slide if (get_ddl_field('image_size') == 'cover') { ?> style="background: url(<?php the_ddl_sub_field('slide_url'); ?> ) no-repeat; background-size:cover;" <?php } ?> > <?php if (get_ddl_field('image_size') == '') { ?> <img src="<?php the_ddl_sub_field('slide_url'); ?> "> <?php } ?> <div class="carousel-caption"> <h4> <?php the_ddl_sub_field('slide_title'); ?> </h4> <p> <?php the_ddl_sub_field('slide_text'); ?> </p> </div> </div> <?php } ?> </div> <a class="left carousel-control" href="#slider-<?php echo $unique_id; ?> " data-slide="prev">‹</a> <a class="right carousel-control" href="#slider-<?php echo $unique_id; ?> " data-slide="next">›</a> </div> <?php return ob_get_clean(); }