/gist:bfbf909055e7b967dd5b Secret
Last active
December 18, 2015 19:39
Star
You must be signed in to star a gist
template-builder.php for Enfold - Shows -- meta + comments + previous/next post -- with advanced layouts in posts. (not official release, hacky, temp solution)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $avia_config, $post; | |
if ( post_password_required() ) { | |
get_template_part( 'page' ); | |
exit( ); | |
} //post_password_required() | |
get_header(); | |
$what_viewing = 'page'; | |
if ( is_singular( 'post' ) ) { | |
$meta_content_holder = ""; | |
$meta_content_holder_end = ""; | |
$what_viewing = 'blog'; | |
$blog_style = !empty( $avia_config[ 'blog_style' ] ) ? $avia_config[ 'blog_style' ] : avia_get_option( 'blog_style', 'multi-big' ); | |
$blog_content = !empty( $avia_config[ 'blog_content' ] ) ? $avia_config[ 'blog_content' ] : "content"; | |
$title = __( 'Blog - Latest News', 'avia_framework' ); | |
$t_link = home_url( '/' ); | |
$t_sub = ""; | |
if ( get_post_meta( get_the_ID(), 'header', true ) != 'no' ) | |
echo avia_title( array( | |
'title' => $title, | |
'link' => $t_link, | |
'subtitle' => $t_sub | |
) ); | |
$the_id = get_the_ID(); | |
$post_class = "post-entry-" . $the_id . " " . $blog_style; | |
$post_format = get_post_format() ? get_post_format() : 'standard'; | |
$meta_content_holder .= "<div class='" . implode( " ", get_post_class( 'post-entry post-entry-type-blog' . $post_format . " " . $post_class ) ) . "'>"; | |
$meta_content_holder .= "<div class='entry-content clearfix {$post_format}-content'><h2 class='post_title'>"; | |
$meta_content_holder .= "<a href='" . get_permalink( $the_id ) . "' rel='bookmar' title='" . get_the_title() . "' >" . get_the_title( $the_id ) . "</a>"; | |
$meta_content_holder .= "</h2><span class='post-meta-infos' style='padding-bottom: 30px;'>"; | |
$meta_content_holder .= "<span class='date-container minor-meta'>" . get_the_time( 'd M Y' ) . "</span>"; | |
$meta_content_holder .= "<span class='text-sep'>/</span>"; | |
if ( comments_open() ) { | |
$meta_content_holder .= "<span class='comment-container minor-meta'>"; | |
$meta_content_holder_end .= "</span>"; | |
$meta_content_holder_end .= "<span class='text-sep'>/</span>"; | |
} //comments_open() | |
$taxonomies = get_object_taxonomies( get_post_type( $the_id ) ); | |
$cats = ''; | |
$excluded_taxonomies = apply_filters( 'avf_exclude_taxonomies', array( | |
'post_tag', | |
'post_format' | |
), get_post_type( $the_id ), $the_id ); | |
if ( !empty( $taxonomies ) ) { | |
foreach ( $taxonomies as $taxonomy ) { | |
if ( !in_array( $taxonomy, $excluded_taxonomies ) ) { | |
$cats .= get_the_term_list( $the_id, $taxonomy, '', ', ', '' ) . ' '; | |
} //!in_array( $taxonomy, $excluded_taxonomies ) | |
} //$taxonomies as $taxonomy | |
} //!empty( $taxonomies ) | |
if ( !empty( $cats ) ) { | |
$meta_content_holder_end .= '<span class="blog-categories minor-meta">' . __( 'in', 'avia_framework' ) . " "; | |
$meta_content_holder_end .= $cats; | |
$meta_content_holder_end .= '</span><span class="text-sep">/</span>'; | |
} //!empty( $cats ) | |
$meta_content_holder_end .= '<span class="blog-author minor-meta">' . __( 'by', 'avia_framework' ) . " "; | |
$meta_content_holder_end .= the_author_posts_link(); | |
$meta_content_holder_end .= '</span>'; | |
$meta_content_holder_end .= '</span></div>'; | |
} //is_singular( 'post' ) | |
else { | |
if ( get_post_meta( get_the_ID(), 'header', true ) != 'no' ) | |
echo avia_title(); | |
} | |
$content = apply_filters( 'avia_builder_precompile', get_post_meta( get_the_ID(), '_aviaLayoutBuilderCleanData', true ) ); | |
$content = apply_filters( 'the_content', $content ); | |
$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' ], array( | |
'av_section', | |
'av_layerslider', | |
'av_slideshow_full', | |
'av_fullscreen' | |
) ) ) { | |
echo avia_new_section( array( | |
'close' => false | |
) ); | |
} //!$first_el || !in_array( $first_el[ 'tag' ], array( 'av_section', 'av_layerslider', 'av_slideshow_full', 'av_fullscreen' ) ) | |
if ( is_singular( 'post' ) ) { | |
echo $meta_content_holder; | |
comments_popup_link( "0 " . __( 'Comments', 'avia_framework' ), "1 " . __( 'Comment', 'avia_framework' ), "% " . __( 'Comments', 'avia_framework' ), 'comments-link', "" . __( 'Comments Disabled', 'avia_framework' ) ); | |
echo $meta_content_holder_end; | |
} //is_singular( 'post' ) | |
echo $content; | |
if ( is_singular( 'post' ) ) { | |
if ( has_tag() ) { | |
echo '<span class="blog-tags minor-meta">'; | |
the_tags( '<strong>' . __( 'Tags:', 'avia_framework' ) . '</strong><span> ' ); | |
echo '</span></span>'; | |
} //has_tag() | |
echo "<div class='post_delimiter'></div>"; | |
echo "<div class='post_author_timeline'></div>"; | |
echo "</div>"; | |
} //is_singular( 'post' ) | |
if ( !$last_el || !in_array( $last_el[ 'tag' ], array( | |
'av_layerslider', | |
'av_slideshow_full', | |
'av_fullscreen' | |
) ) ) { | |
echo " </div>"; | |
echo " </div>"; | |
echo " </div>"; | |
$avia_config[ 'currently_viewing' ] = $what_viewing; | |
get_sidebar(); | |
} //!$last_el || !in_array( $last_el[ 'tag' ], array( 'av_layerslider', 'av_slideshow_full', 'av_fullscreen' ) ) | |
else { | |
echo "<div><div>"; | |
} | |
if ( is_singular( 'portfolio' ) || is_singular( 'post' ) ) { | |
get_template_part( 'includes/related-posts' ); | |
comments_template( '/includes/comments.php' ); | |
} //is_singular( 'portfolio' ) || is_singular( 'post' ) | |
echo "</div><!--end builder template-->"; | |
get_footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment