function frontend_render_cell_content($target)
 {
     global $ddl_fields_api;
     $ddl_fields_api->set_current_cell_content($this->get_content());
     if (function_exists('render_view')) {
         global $WPV_view_archive_loop, $wp_query;
         $WPV_view_archive_loop->query = clone $wp_query;
         $WPV_view_archive_loop->in_the_loop = true;
         $target->cell_content_callback(render_view(array('id' => get_ddl_field('ddl_layout_view_id'))), $this);
         $WPV_view_archive_loop->in_the_loop = false;
     } else {
         $target->cell_content_callback(WPDDL_Messages::views_missing_message(), $this);
     }
 }
    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();
    }
function the_ddl_field($field_name)
{
    echo get_ddl_field($field_name);
}
 /**
  * Callback function for display the cell in the front end.
  * 
  * Render captured BuddyPress output.
  * @see bp_cell_init()
  * @uses apply_filters( 'the_content' );
  * @param type $cell_settings
  * @return type
  */
 public function content_callback($cell_settings)
 {
     /*
      * $wp_query->in_the_loop has to be forced as TRUE
      * because BP will not render if FALSE.
      * It's set by WP with the_post() call (in loop have_posts()).
      */
     $component = get_ddl_field('bp_component_load');
     if ($this->is_bp_active_component($component) === false) {
         $output = $this->missing_component_message($component);
     } else {
         $output = $this->get_component_loop($component);
     }
     return $output;
 }
    function video_cell_content_callback()
    {
        $video_url = get_ddl_field('video_url');
        $filter = '#^(?:https?://)?(?:www\\.)?(?:youtu\\.be/|youtube\\.com(?:/embed/|/v/|/watch\\?v=|/watch\\?.+&v=))([\\w-]{11})(?:.+)?$#x';
        preg_match($filter, $video_url, $matches);
        if (isset($matches[1])) {
            $video_id = $matches[1];
        } else {
            $video_id = null;
        }
        ob_start();
        ?>

		<style>
			.video-container iframe {
				width: 100%;
			}
		</style>

            <?php 
        if ($video_id === null) {
            ?>

            <div class="video-container">
                <?php 
            echo WPDDL_Messages::display_message(WPDDL_Messages::$message_warning, sprintf(__('The URL %s is not a valid YouTube URL.', 'ddl-layouts'), $video_url));
            ?>
            </div>

            <?php 
        } else {
            ?>

			<div class="video-container">
				<iframe height="<?php 
            the_ddl_field('video_height');
            ?>
" src="//www.youtube.com/embed/<?php 
            echo $video_id;
            ?>
" frameborder="0" ></iframe>
			</div>

            <?php 
        }
        ?>

		<?php 
        return ob_get_clean();
    }
 function cred_cell_content_callback()
 {
     if (defined('CRED_FORMS_CUSTOM_POST_NAME')) {
         $fm = CRED_Loader::get('MODEL/Forms');
         $form = $fm->getForm(get_ddl_field('ddl_layout_cred_id'));
         if ($form) {
             return do_shortcode('[cred-form form="' . get_ddl_field('ddl_layout_cred_id') . '"]');
         } else {
             return WPDDL_Messages::cred_form_missing_message();
         }
     } else {
         return WPDDL_Messages::cred_missing_message();
     }
 }
    function ddl_render_comments_list($comments, $post, $load_page = '')
    {
        ob_start();
        ?>
		
		<div id="comments">
			<?php 
        if (post_password_required($post)) {
            ?>
				<p class="nopassword"><?php 
            the_ddl_field('password_text');
            ?>
</p>
			</div><!-- #comments -->
			<?php 
            return ob_get_clean();
        }
        ?>
	
			
			<?php 
        if (comments_open()) {
            $num_comments = get_comments_number();
            ?>
				<?php 
            if ($num_comments > 0) {
                ?>


					<h2 id="comments-title">
					<?php 
                $one_comment_text = str_replace(array('%TITLE%', '%COUNT%'), array('%2$s', '%1$s'), get_ddl_field('title_one_comment'));
                $two_comments_text = str_replace(array('%TITLE%', '%COUNT%'), array('%2$s', '%1$s'), get_ddl_field('title_multi_comments'));
                printf(_n($one_comment_text, $two_comments_text, $num_comments), number_format_i18n($num_comments), '<span>' . $post->post_title . '</span>');
                ?>
					</h2>
					<?php 
                if (get_comment_pages_count($comments) > 1 && get_option('page_comments')) {
                    ?>
					<?php 
                    add_filter('previous_comments_link_attributes', 'ddl_add_previous_comments_link_data');
                    add_filter('next_comments_link_attributes', 'ddl_add_next_comments_link_data');
                    ?>
					<nav id="comment-nav-above">						
						<div class="nav-previous js-ddl-previous-link"><?php 
                    previous_comments_link(get_ddl_field('ddl_prev_link_text'));
                    ?>
</div>
						<div class="nav-next js-ddl-next-link"><?php 
                    next_comments_link(get_ddl_field('ddl_next_link_text'));
                    ?>
</div>
					</nav>
					<?php 
                }
                // check for comment navigation
                ?>
					
						<?php 
                $comments_defaults = array();
                //Set comments style
                $comments_defaults['style'] = apply_filters('ddl_comment_cell_style', 'ul');
                //Avatar Size
                if (get_ddl_field('avatar_size') != '') {
                    $comments_defaults['avatar_size'] = get_ddl_field('avatar_size');
                }
                //Reply text
                if (get_ddl_field('reply_text') != '') {
                    $comments_defaults['reply_text'] = get_ddl_field('reply_text');
                }
                if (get_comment_pages_count($comments) > 1 && get_option('page_comments')) {
                    $comments_defaults['per_page'] = get_option('comments_per_page');
                    if (empty($load_page)) {
                        if ('newest' == get_option('default_comments_page')) {
                            $comments_defaults['page'] = get_comment_pages_count($comments);
                        } else {
                            $comments_defaults['page'] = 1;
                        }
                    } else {
                        //Current page
                        $comments_defaults['page'] = $load_page;
                    }
                }
                $before_comments_list = '<ul class="commentlist">';
                $after_comments_list = '</ul>';
                if ($comments_defaults['style'] == 'ol') {
                    $before_comments_list = '<ol class="commentlist">';
                    $after_comments_list = '</ol>';
                }
                if ($comments_defaults['style'] == 'div') {
                    $before_comments_list = '<div class="commentlist">';
                    $after_comments_list = '</div>';
                }
                echo '<div id="comments-listing">';
                echo $before_comments_list;
                //Generate and print comments listing
                wp_list_comments($comments_defaults, $comments);
                echo $after_comments_list;
                echo '</div>';
                ?>
						
						
				<?php 
            }
            ?>
				<?php 
            // Generate comment form
            comment_form();
            ?>
				
			<?php 
        } else {
            ?>
				<p class="nocomments"><?php 
            the_ddl_field('comments_closed_text');
            ?>
</p>
			<?php 
        }
        ?>
			
		</div>
		<?php 
        return ob_get_clean();
    }
 function views_content_grid_content_callback()
 {
     //Render View
     if (function_exists('render_view')) {
         $mode = get_ddl_field('parametric_mode');
         $target = get_ddl_field('parametric_mode_target');
         $target_id = get_ddl_field('parametric_target_id');
         if ($target == 'self') {
             $target_id = 'self';
         }
         if ($mode == 'form' && !empty($target_id)) {
             return render_view(array('id' => get_ddl_field('ddl_layout_view_id'), 'target_id' => $target_id));
         } else {
             if ($mode == 'results') {
                 return render_view(array('id' => get_ddl_field('ddl_layout_view_id'), 'view_display' => 'layout'));
             } else {
                 return render_view(array('id' => get_ddl_field('ddl_layout_view_id')));
             }
         }
     } else {
         return WPDDL_Messages::views_missing_message();
     }
 }
    function imagebox_cell_content_callback()
    {
        ob_start();
        $title = get_ddl_field('box_title');
        $content = get_ddl_field('box_content');
        ?>

		<?php 
        if (!get_ddl_field('disable_bootstrap_thumbnail')) {
            ?>
        <div class="thumbnail">
        <?php 
        }
        ?>
			<img src="<?php 
        the_ddl_field('box_image');
        ?>
">
			<?php 
        if ($title || $content) {
            ?>
				<div class="caption text-center">
					<?php 
            if ($title) {
                ?>
						<h3>
							<?php 
                echo $title;
                ?>
						</h3>
					<?php 
            }
            ?>
					<?php 
            if ($content) {
                ?>
						<p>
							<?php 
                echo $content;
                ?>
						</p>
					<?php 
            }
            ?>
				</div>
			<?php 
        }
        ?>
		<?php 
        if (!get_ddl_field('disable_bootstrap_thumbnail')) {
            ?>
        </div>
        <?php 
        }
        ?>
		<?php 
        return ob_get_clean();
    }
    function menu_cell_content_callback()
    {
        global $wpddlayout;
        $id = 'ddl-navbar-collapse-' . md5(time() + rand(0, 100));
        $menu_name = get_ddl_field('menu_name');
        $menu_dir = get_ddl_field('menu_dir');
        $menu_depth = get_ddl_field('menu_depth');
        $menu_class = 'ddl-nav ddl-navbar-nav ' . 'ddl-' . $menu_dir;
        $container_class = 'collapse ddl-navbar-collapse ' . $id;
        $menu_style = 'bootstrap';
        $wpddlayout->enqueue_scripts('ddl-menu-cell-front-end');
        ob_start();
        ?>

		<nav class="ddl-nav-wrap ddl-navbar ddl-navbar-default ddl-<?php 
        echo $menu_dir;
        ?>
">
			 <button type="button" class="ddl-navbar-toggle" data-toggle="collapse" data-target=".<?php 
        echo $id;
        ?>
">		      
		        <span class="ddl-icon-bar"></span>
		        <span class="ddl-icon-bar"></span>
		        <span class="ddl-icon-bar"></span>
		     </button>
			<?php 
        $args = array('menu' => $menu_name, 'menu_class' => $menu_class, 'container_class' => $container_class, 'depth' => $menu_depth, 'walker' => get_walker($menu_style));
        wp_nav_menu($args);
        ?>
		</nav>        

		<?php 
        return ob_get_clean();
    }