Skip to content

Instantly share code, notes, and snippets.

@josueochoa
Created July 5, 2014 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josueochoa/012bbe9c40389abbcabb to your computer and use it in GitHub Desktop.
Save josueochoa/012bbe9c40389abbcabb to your computer and use it in GitHub Desktop.
<?php
/*
Template Name: Custom Loop Template
*/
global $avia_config, $post;
if ( post_password_required() )
{
get_template_part( 'page' ); exit();
}
/*
* get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
*/
get_header();
// set up post data
setup_postdata( $post );
//check if we want to display breadcumb and title
if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title();
//filter the content for content builder elements
$content = apply_filters('avia_builder_precompile', get_post_meta(get_the_ID(), '_aviaLayoutBuilderCleanData', true));
//if user views a preview me must use the content because WordPress doesn't update the post meta field
if(is_preview())
{
$content = apply_filters('avia_builder_precompile', get_the_content());
}
/* Custom loop here */
// fullscreen video do_shortcode example
echo do_shortcode("[av_fullscreen size='extra_large' animation='slide' autoplay='false' interval='5']
[av_fullscreen_slide slide_type='video' id='' attachment='' position='top left' video='http://vimeo.com/23872841' video_cover='av-element-cover' video_controls='aviaTBaviaTBvideo_controls' video_mute='aviaTBaviaTBvideo_mute' title='Enfold now supports video slides' caption_pos='caption_center caption_center_framed caption_framed' link_apply='button button-two' link='lightbox' link_target='' button_label='Learn more' button_color='theme-color' link1='www.kriesi.at/themes/enfold/features/' link_target1='' button_label2='Buy Now!' button_color2='light' link2='http://themeforest.net/item/enfold-responsive-multipurpose-theme/4519990?ref=kriesi' link_target2='_blank' video_loop='']
The Theme now supports video slides and video backgrounds from youtube and vimeo, as well as self hosted html5 video files
[/av_fullscreen_slide]
[av_fullscreen_slide slide_type='video' id='' attachment='' position='top left' video='http://vimeo.com/12432139' video_cover='av-element-cover' video_controls='aviaTBaviaTBvideo_controls' video_mute='aviaTBaviaTBvideo_mute' title='Several Options' caption_pos='caption_right caption_right_framed caption_framed' link_apply='button' link='lightbox' link_target='' button_label='So cool! Buy now!' button_color='light' link1='http://themeforest.net/item/enfold-responsive-multipurpose-theme/4519990?ref=kriesi' link_target1='_blank' button_label2='' button_color2='light' link2='' link_target2='' video_loop='']
You get additional Video Options when embedding a video, like muting the player, looping the video and hiding its controls
[/av_fullscreen_slide]
[/av_fullscreen]");
/* Custom loop ends here */
//check first builder element. if its a section or a fullwidth slider we dont need to create the default openeing divs here
$first_el = isset(ShortcodeHelper::$tree[0]) ? ShortcodeHelper::$tree[0] : false;
$last_el = !empty(ShortcodeHelper::$tree) ? end(ShortcodeHelper::$tree) : false;
if(!$first_el || !in_array($first_el['tag'], AviaBuilder::$full_el ) )
{
echo avia_new_section(array('close'=>false,'main_container'=>true));
}
$content = apply_filters('the_content', $content);
$content = apply_filters('avf_template_builder_content', $content);
echo $content;
$avia_wp_link_pages_args = apply_filters('avf_wp_link_pages_args', array(
'before' =>'<nav class="pagination_split_post">'.__('Pages:','avia_framework'),
'after' =>'</nav>',
'pagelink' => '<span>%</span>',
'separator' => ' ',
));
wp_link_pages($avia_wp_link_pages_args);
//only close divs if the user didnt add fullwidth slider elements at the end. also skip sidebar if the last element is a slider
if(!$last_el || !in_array($last_el['tag'], AviaBuilder::$full_el_no_section ) )
{
$cm = avia_section_close_markup();
echo "</div>";
echo "</div>$cm <!-- section close by builder template -->";
//get the sidebar
$avia_config['currently_viewing'] = 'page';
get_sidebar();
}
else
{
echo "<div><div>";
}
echo ' </div><!--end builder template-->';
echo '</div><!-- close default .container_wrap element -->';
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment