secret
Last active

template-builder.php for Enfold - Shows -- meta + comments + previous/next post -- with advanced layouts in posts. (not official release, hacky, temp solution)

  • Download Gist
gistfile1.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
<?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();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.