';
echo '
';
foreach( $decoded_blocks as $block ) :
$option = $block->option;
if( $option ) {
$block_name = $block->name;
$layout = 'one';
if( $block_name === "banner-slider" ) $layout = 'four';
if( $block_name === "posts-grid" ) $layout = 'seven';
get_template_part( 'template-parts/' .$block_name. '/layout', $layout, $block );
}
endforeach;
echo '
';
echo '
';
if( is_active_sidebar( 'frontpage-middle-left-sidebar' ) ) :
dynamic_sidebar( 'frontpage-middle-left-sidebar' );
else :
the_widget( 'WP_Widget_Recent_Posts' );
?>
';
echo '
';
echo '';
}
endif;
if( ! function_exists( 'armonia_bottom_full_width_sec' ) ) :
/**
* Bottom Full Width Section
*
*/
function armonia_bottom_full_width_sec() {
$frontpage_bottom_full_width_blocks = get_theme_mod( 'frontpage_bottom_full_width_blocks', json_encode(array(
array(
'name' => 'posts-list',
'option' => true,
'blockTitle'=> esc_html__( 'You may have missed', 'armonia' ),
'category' => '',
'count' => 4,
'excerptOption'=> true,
'dateOption' => true,
'commentOption' => true,
'buttonOption' => false
),
array(
'name' => 'posts-grid',
'option' => false,
'blockTitle'=> esc_html__( 'Posts Grid', 'armonia' ),
'category' => '',
'count' => 4,
'excerptOption'=> true,
'dateOption' => true,
'commentOption' => true,
'buttonOption' => true,
'layout' => 'one'
)
)
)
);
if( ! $frontpage_bottom_full_width_blocks ) {
return;
}
$decoded_blocks = json_decode( $frontpage_bottom_full_width_blocks );
if( ! in_array( true, array_column( $decoded_blocks, 'option' ) ) ) {
return;
}
echo '
';
foreach( $decoded_blocks as $block ) :
$option = $block->option;
if( $option ) {
$block_name = $block->name;
if( isset( $block->layout ) ) {
$layout = $block->layout;
} else {
$layout = 'one';
if( $block_name === "banner-slider" ) $layout = 'four';
}
get_template_part( 'template-parts/' .$block_name. '/layout', $layout, $block );
}
endforeach;
echo '';
}
endif;
if( ! function_exists( 'armonia_bottom_full_width_woocommerce_sec' ) ) :
/**
* Bottom Full Width Woocommerce Section
*
*/
function armonia_bottom_full_width_woocommerce_sec() {
if( ! class_exists( 'WooCommerce' ) ) return;
$frontpage_bottom_full_width_woocommerce_blocks = get_theme_mod( 'frontpage_bottom_full_width_woocommerce_blocks', json_encode(array(
array(
'name' => 'woo-products',
'option' => true,
'blockTitle'=> esc_html__( 'Latest Products', 'armonia' ),
'productType' => 'latest',
'categories' => '[]',
'count' => 4
)
)
)
);
if( ! $frontpage_bottom_full_width_woocommerce_blocks ) {
return;
}
$decoded_blocks = json_decode( $frontpage_bottom_full_width_woocommerce_blocks );
if( ! in_array( true, array_column( $decoded_blocks, 'option' ) ) ) {
return;
}
echo '
';
foreach( $decoded_blocks as $block ) :
$option = $block->option;
if( $option ) {
$block_name = $block->name;
if( isset( $block->layout ) ) {
$layout = $block->layout;
} else {
$layout = 'one';
if( $block_name === "banner-slider" ) $layout = 'four';
}
get_template_part( 'template-parts/' .$block_name. '/layout', $layout, $block );
}
endforeach;
echo '';
}
endif;
add_action( 'armonia_frontpage_section_hook', 'armonia_top_full_width_sec', 10 );
add_action( 'armonia_frontpage_section_hook', 'armonia_top_about_author__sec', 10 );
add_action( 'armonia_frontpage_section_hook', 'armonia_middle_left_content_sec', 20 );
add_action( 'armonia_frontpage_section_hook', 'armonia_middle_right_content_sec', 30 );
add_action( 'armonia_frontpage_section_hook', 'armonia_bottom_full_width_woocommerce_sec', 40 );
add_action( 'armonia_frontpage_section_hook', 'armonia_bottom_full_width_sec', 50 );
if( ! function_exists( 'armonia_footer_three_column_sec' ) ) :
/**
* Footer three column section fnc
*
*/
function armonia_footer_three_column_sec() {
if( ! is_front_page() ) {
return;
}
$footer_three_column_blocks = get_theme_mod( 'footer_three_column_blocks', json_encode(array(
array(
'label'=> esc_html__( 'Column One', 'armonia' ),
'name' => 'posts-column',
'category' => '',
'dateOption' => true,
'layout' => 'one'
),
array(
'label'=> esc_html__( 'Column Two', 'armonia' ),
'name' => 'posts-column',
'category' => '',
'dateOption' => true,
'layout' => 'two'
),
array(
'label'=> esc_html__( 'Column Three', 'armonia' ),
'name' => 'posts-column',
'category' => '',
'dateOption' => true,
'layout' => 'three'
)
)
)
);
if( ! $footer_three_column_blocks ) {
return;
}
echo '
';
}
endif;
add_action( 'armonia_before_footer_hook', 'armonia_footer_three_column_sec', 40 );