Ek Olarak:
/*
Template Name: portfolio
*/
get_header();
if( have_posts() ){
// Current page sidebar related meta
$sidebar_position = get_post_meta( get_the_ID(), 'nfw_sidebar_position', true );
// checks if a static page was selected as front page
if( 'page' == get_option( 'show_on_front' ) ){
// Start the Loop.
while( have_posts() ){
the_post();
$post_id = get_the_ID();
$page_header_toggle = get_post_meta( $post_id, 'nfw_header_toggle', true );
$page_header_title = get_post_meta( $post_id, 'nfw_header_title', true );
$page_header_icon = get_post_meta( $post_id, 'nfw_header_icon', true );
if( $page_header_toggle == 'on' ):
?>
if( trim( $page_header_icon ) != '' ){
echo '';
}
if( trim( $page_header_title ) != '' ){
echo '' . esc_html( $page_header_title ) . '
';
}
?>
endif;
$content = $post->post_content;
if( !empty( $sidebar_position ) && $sidebar_position != 'none' || strpos( $content, '[/vc_row]' ) === false ){
echo '';
}
if( !empty( $sidebar_position ) ){
if( $sidebar_position == 'left' ){
get_sidebar();
}
}
if( !empty( $sidebar_position ) && $sidebar_position != 'none' ){
echo '';
} else if( strpos( $content, '[/vc_row]' ) === false ){
echo '';
}
the_content();
if( !empty( $sidebar_position ) && $sidebar_position != 'none' || strpos( $content, '[/vc_row]' ) === false ){
echo '';
}
if( !empty( $sidebar_position ) ){
if( $sidebar_position == 'right' ){
get_sidebar();
}
}
if( !empty( $sidebar_position ) && $sidebar_position != 'none' || strpos( $content, '[/vc_row]' ) === false ){
echo '';
}
}
} else{
get_template_part( 'index' );
}
} else{
get_template_part( 'content', 'none' );
}
get_footer();