$_wp_additional_image_sizes[ $_size ]['width'], 'height' => $_wp_additional_image_sizes[ $_size ]['height'], 'crop' => $_wp_additional_image_sizes[ $_size ]['crop'], ); } } return $sizes; } endif; if ( ! function_exists( 'businex_get_image_size' ) ) : /** * Get size information for a specific image size. * * @since Businex 1.0.0 * @uses businex_get_image_sizes() * @param string $size The image size for which to retrieve data. * @return bool|array $size Size data about an image size or false if the size doesn't exist. */ function businex_get_image_size( $size ) { $sizes = businex_get_image_sizes(); if ( isset( $sizes[ $size ] ) ) { return $sizes[ $size ]; } return false; } endif; if ( ! function_exists( 'businex_get_image_width' ) ) : /** * Get the width of a specific image size. * * @since Businex 1.0.0 * @uses businex_get_image_size() * @param string $size The image size for which to retrieve data. * @return bool|string $size Width of an image size or false if the size doesn't exist. */ function businex_get_image_width( $size ) { if ( ! $size = businex_get_image_size( $size ) ) { return false; } if ( isset( $size['width'] ) ) { return $size['width']; } return false; } endif; if ( ! function_exists( 'businex_get_image_height' ) ) : /** * Get the height of a specific image size. * * @since Businex 1.0.0 * @uses businex_get_image_size() * @param string $size The image size for which to retrieve data. * @return bool|string $size Height of an image size or false if the size doesn't exist. */ function businex_get_image_height( $size ) { if ( ! $size = businex_get_image_size( $size ) ) { return false; } if ( isset( $size['height'] ) ) { return $size['height']; } return false; } endif; if( ! function_exists( 'businex_post_thumbnail' ) ): /** * Prints featured image or dummy image if no featured image for posts * * @since Businex 1.0.0 * @param array $args * @param bool $show_eye whether to show eye icon while hover. default: true. * @return void */ function businex_post_thumbnail( $args ){ $defaults = array( 'size' => 'large', 'dummy' => true, 'permalink' => true ); $args = wp_parse_args( $args, $defaults ); # Don't print even the div when no thumbnail and dummy is disabled if( '' == get_the_post_thumbnail() && !$args[ 'dummy' ] ){ return; } ?>
$args[ 'size' ] ) ); echo sprintf( '', esc_url( $feat_image_url ) ); } ?>
'thumbnail', ); $args = wp_parse_args( $args, $defaults ); if( 'thumbnail' == $args[ 'size' ] ){ $width = $height = '150'; }else if( 'medium' == $args[ 'size' ] ){ $width = $height = '300'; }else if( 'large' == $args[ 'size' ] ){ $width = $height = '1024'; }else{ $width = businex_get_image_width( $args[ 'size' ] ); $height = businex_get_image_height( $args[ 'size' ] ); } $url = get_theme_file_uri( 'assets/images/placeholder/businex-' . $width . '-' . $height . '.png' ); return apply_filters( 'businex_dummy_image_url', $url, $args ); } endif; if( ! function_exists( 'businex_get_thumbnail_url' ) ): /** * Gets the url of Featured Image if not a dummy url. * * @since Businex 1.0.0 * @return string | NULL */ function businex_get_thumbnail_url( $args ){ $defaults = array( 'size' => 'large', 'dummy' => true ); $args = wp_parse_args( $args, $defaults ); $dummy = false; if( $args[ 'dummy' ] ){ $dummy = businex_get_dummy_image( array( 'size' => $args[ 'size' ], )); } $url = has_post_thumbnail() ? get_the_post_thumbnail_url( get_the_ID(), $args[ 'size' ] ) : $dummy; return $url; } endif; if( !function_exists( 'businex_get_callback_banner_url' ) ): /** * Return banner image url for callback section * @uses businex_get_thumbnail_url * @since Businex 1.0.0 */ function businex_get_callback_banner_url(){ $image = businex_get_option( 'callback_image' ); if( !$image ){ $image = get_theme_file_uri( '/assets/images/placeholder/businex-banner-1920-850.jpg' ); } return apply_filters( 'businex_callback_banner_image', $image ); } endif; if( !function_exists( 'businex_get_footer_callback_banner_url' ) ): /** * Return banner image url for footer callback section * @uses businex_get_thumbnail_url * @since Businex 1.0.0 */ function businex_get_footer_callback_banner_url(){ $image = businex_get_option( 'footer_callback_image' ); if( !$image ){ $image = get_theme_file_uri( '/assets/images/placeholder/businex-banner-1920-850.jpg' ); } return apply_filters( 'businex_footer_callback_banner_image', $image ); } endif;