add( 'required', esc_html__( 'You must supply a valid number.', 'blogable' ) ); } elseif ( $value < 3 ) { $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 3', 'blogable' ) ); } elseif ( $value > 6 ) { $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 6', 'blogable' ) ); } return $validity; } endif; if ( ! function_exists( 'blogable_validate_long_excerpt' ) ) : function blogable_validate_long_excerpt( $validity, $value ){ $value = intval( $value ); if ( empty( $value ) || ! is_numeric( $value ) ) { $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'blogable' ) ); } elseif ( $value < 5 ) { $validity->add( 'min_no_of_words', esc_html__( 'Minimum no of words is 5', 'blogable' ) ); } elseif ( $value > 100 ) { $validity->add( 'max_no_of_words', esc_html__( 'Maximum no of words is 100', 'blogable' ) ); } return $validity; } endif; if ( ! function_exists( 'blogable_validate_blog_count' ) ) : function blogable_validate_blog_count( $validity, $value ){ $value = intval( $value ); if ( empty( $value ) || ! is_numeric( $value ) ) { $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'blogable' ) ); } elseif ( $value < 3 ) { $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 3', 'blogable' ) ); } elseif ( $value > 12 ) { $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 12', 'blogable' ) ); } return $validity; } endif; if ( ! function_exists( 'blogable_validate_sponsor_count' ) ) : function blogable_validate_sponsor_count( $validity, $value ){ $value = intval( $value ); if ( empty( $value ) || ! is_numeric( $value ) ) { $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'blogable' ) ); } elseif ( $value < 1 ) { $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'blogable' ) ); } elseif ( $value > 5 ) { $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 5', 'blogable' ) ); } return $validity; } endif; if ( ! function_exists( 'blogable_validate_stories_count' ) ) : function blogable_validate_stories_count( $validity, $value ){ $value = intval( $value ); if ( empty( $value ) || ! is_numeric( $value ) ) { $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'blogable' ) ); } elseif ( $value < 3 ) { $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 3', 'blogable' ) ); } elseif ( $value > 12 ) { $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 12', 'blogable' ) ); } return $validity; } endif; if ( ! function_exists( 'blogable_validate_recent_products_count' ) ) : function blogable_validate_recent_products_count( $validity, $value ){ $value = intval( $value ); if ( empty( $value ) || ! is_numeric( $value ) ) { $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'blogable' ) ); } elseif ( $value < 1 ) { $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 1', 'blogable' ) ); } elseif ( $value > 12 ) { $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 12', 'blogable' ) ); } return $validity; } endif; if ( ! function_exists( 'blogable_validate_recent_products_count' ) ) : function blogable_validate_recent_products_count( $validity, $value ){ $value = intval( $value ); if ( empty( $value ) || ! is_numeric( $value ) ) { $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'blogable' ) ); } elseif ( $value < 3 ) { $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 3', 'blogable' ) ); } elseif ( $value > 6 ) { $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 6', 'blogable' ) ); } return $validity; } endif; if ( ! function_exists( 'blogable_validate_popular_post_count' ) ) : function blogable_validate_popular_post_count( $validity, $value ){ $value = intval( $value ); if ( empty( $value ) || ! is_numeric( $value ) ) { $validity->add( 'required', esc_html__( 'You must supply a valid number.', 'blogable' ) ); } elseif ( $value < 2 ) { $validity->add( 'min_no_of_posts', esc_html__( 'Minimum no of posts is 2', 'blogable' ) ); } elseif ( $value > 9 ) { $validity->add( 'max_no_of_posts', esc_html__( 'Maximum no of posts is 9', 'blogable' ) ); } return $validity; } endif;