hooks(); } /** * Main AzonBooster_Related_Posts Instance. * * Ensures only one instance of AzonBooster_Related_Posts is loaded or can be loaded. * * @since 1.0.0 * @static * @return AzonBooster_Related_Posts - Main instance. */ public static function instance() { if ( is_null( self::$_instance ) ) { self::$_instance = new self(); } return self::$_instance; } public function hooks() { add_filter('azonbooster_show_related_posts', array( $this, 'show_related_post' ) ); add_filter( 'azonbooster_show_related_posts_style', array( $this, 'display_stle') ); add_filter( 'azonbooster_show_related_posts_num_posts', array( $this, 'posts_per_page' ) ); add_filter( 'azonbooster_show_related_posts_by', array( $this, 'related_by' )); } /** * Show and Hide Related Posts * * @since 1.0.0 * @return boolean */ public function show_related_post() { return azonbooster_get_option( 'blog_single_post_related_posts', true ); } /** * Related Posts display style. * * @since 1.0.0 * @access public * @return string */ public function display_stle() { return azonbooster_get_option( 'blog_single_post_related_posts_style', 'grid' ); } /** * Number Related Posts to show. * * @since 1.0.0 * @access public * @return number */ public function posts_per_page() { return azonbooster_get_option( 'blog_single_post_related_posts_num', 8); } /** * Number of columns of Related Posts (Only grid style.). * * @since 1.0.0 * @access public * @return number */ public function num_cols() { return azonbooster_get_option( 'blog_single_post_related_posts_num_cols', 4 ); } /** * Related Posts display by. * * @since 1.0.0 * @access public * @return string */ public function related_by() { return azonbooster_get_option( 'blog_single_post_related_posts_by', 'cat' ); } /** * Related Posts Section Title. * * @since 1.0.0 * @access public * @return string */ public function section_title() { return azonbooster_get_option( 'blog_single_post_related_posts_title', __('See More Related', 'azonbooster' ) ); } /** * Render Related Posts * * @since 1.0.0 * @access public * @return void */ public function render_related_posts( $posts, $style ) { ?> num_cols() ); switch ( $num_col ) { case 1: $size = 'full'; break; case 2: case 3: $size = 'large'; break; case 4: case 6: $size = 'large'; break; default: $size = 'medium'; break; } $num_col_class = 'num-col-' . $num_col; $thumbnail_pos = apply_filters( 'azonbooster_related_posts_thumb_pos', 'top' ); $thumbnail_size = apply_filters( 'azonbooster_related_posts_thumb_size', $size ); ?>