get_posts( $param );
if ( ! empty( $posts ) ) {
echo $this->render_featured_posts( $posts );
}
}
/**
* Render featured posts on Homepage
*
* @param array $posts
* @since 1.2.2
* @return mixed
*/
public function render_featured_posts( $posts ) {
global $post;
$i = 1;
ob_start();
?>
', $columns);
if ( $columns > 1 ) {
$contents = array_chunk( $contents, $columns );
foreach ( $contents as $key => $vals ) {
printf('', $key+1 );
$index = 1;
foreach ( $vals as $v ) {
echo $this->render_main($v, $index);
$index++;
}
echo '
';
}
} else {
echo '';
foreach ( $contents as $content ) {
echo $this->render_main( $content );
}
echo '
';
}
echo ''; // Div container
}
}
private function render_main( $param, $index = 1 ) {
$posts = $this->get_posts( $param );
$content = '';
if ( ! empty( $posts ) ) {
printf( '', $index );
$this->render_category( $param );
echo $this->render_posts( $posts, $param );
echo '
';
}
}
/**
* Render posts from each repeater control
*
* @param array $posts
* @param array $param
* @return string
*/
private function render_posts( $posts, $param ) {
global $post;
ob_start();
$ul_class = 'azb-hmp-style-'. $param['render_style'];
$ul_class .= $param['render_style'] == 'grid' ? ' grid-'. $param['num_cols'] : '';
printf('