@@ -416,21 +416,21 @@ function utopia_is_current_url( string $test_url, $include_params = false ) {
416
416
add_filter ( 'post_thumbnail_html ' , 'utopia_remove_dimension_image_attributes ' , 10 );
417
417
add_filter ( 'image_send_to_editor ' , 'utopia_remove_dimension_image_attributes ' , 10 );
418
418
/**
419
- * Removes width and height attributes from images.
419
+ * Removes width, height, srcset, and sizes attributes from images.
420
420
*
421
- * These attributes are added by WordPress and are not necessary for the
421
+ * These attributes are added by WordPress and may not be necessary for the
422
422
* responsive images generated by the theme. By removing them, we prevent
423
423
* unnecessary requests for image dimensions and potentially reduce page
424
424
* load times.
425
425
*
426
426
* @param string $image The image HTML markup.
427
427
*
428
- * @return string The filtered image HTML markup without width and height
429
- * attributes.
428
+ * @return string The filtered image HTML markup without width, height, srcset,
429
+ * and sizes attributes.
430
430
*/
431
431
function utopia_remove_dimension_image_attributes ( string $ image ): string {
432
432
$ image = preg_replace (
433
- '/(width|height)="\d *"\s/ ' ,
433
+ '/(width|height|srcset|sizes )="[^"] *"\s* / ' ,
434
434
'' ,
435
435
$ image
436
436
);
@@ -767,13 +767,13 @@ function utopia_format_email_link( string $email, string $subject = '' ): string
767
767
}
768
768
769
769
// function cf_search_join( $join ) {
770
- // global $wpdb;
770
+ // global $wpdb;
771
771
772
- // if ( is_search() ) {
773
- // $join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';
774
- // }
772
+ // if ( is_search() ) {
773
+ // $join .=' LEFT JOIN '.$wpdb->postmeta. ' ON '. $wpdb->posts . '.ID = ' . $wpdb->postmeta . '.post_id ';
774
+ // }
775
775
776
- // return $join;
776
+ // return $join;
777
777
// }
778
778
// add_filter('posts_join', 'cf_search_join' );
779
779
@@ -783,15 +783,15 @@ function utopia_format_email_link( string $email, string $subject = '' ): string
783
783
// * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where
784
784
// */
785
785
// function cf_search_where( $where ) {
786
- // global $pagenow, $wpdb;
786
+ // global $pagenow, $wpdb;
787
787
788
- // if ( is_search() ) {
789
- // $where = preg_replace(
790
- // "/\(\s*".$wpdb->posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
791
- // "(".$wpdb->posts.".post_title LIKE $1) OR (".$wpdb->postmeta.".meta_value LIKE $1)", $where );
792
- // }
788
+ // if ( is_search() ) {
789
+ // $where = preg_replace(
790
+ // "/\(\s*".$wpdb->posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
791
+ // "(".$wpdb->posts.".post_title LIKE $1) OR (".$wpdb->postmeta.".meta_value LIKE $1)", $where );
792
+ // }
793
793
794
- // return $where;
794
+ // return $where;
795
795
// }
796
796
// add_filter( 'posts_where', 'cf_search_where' );
797
797
@@ -801,13 +801,13 @@ function utopia_format_email_link( string $email, string $subject = '' ): string
801
801
// * http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_distinct
802
802
// */
803
803
// function cf_search_distinct( $where ) {
804
- // global $wpdb;
804
+ // global $wpdb;
805
805
806
- // if ( is_search() ) {
807
- // return "DISTINCT";
808
- // }
806
+ // if ( is_search() ) {
807
+ // return "DISTINCT";
808
+ // }
809
809
810
- // return $where;
810
+ // return $where;
811
811
// }
812
812
// add_filter( 'posts_distinct', 'cf_search_distinct' );
813
813
@@ -819,20 +819,20 @@ function utopia_search_site_content_via_ajax() {
819
819
}
820
820
821
821
$ query_args = array (
822
- 'post_type ' => array ( 'post ' , 'utopian ' , 'concert ' ),
823
- 's ' => sanitize_text_field ( wp_unslash ( $ _POST ['s ' ] ) ),
822
+ 'post_type ' => array ( 'post ' , 'utopian ' , 'concert ' ),
823
+ 's ' => sanitize_text_field ( wp_unslash ( $ _POST ['s ' ] ) ),
824
824
// 'meta_query' => array(
825
- // 'relation' => 'OR',
826
- // array(
827
- // 'key' => 'start_date',
828
- // 'compare' => 'NOT EXISTS',
829
- // ),
830
- // array(
831
- // 'key' => 'start_date',
832
- // 'value' => gmdate( 'Y-m-d H:i:s' ),
833
- // 'type' => 'DATETIME',
834
- // 'compare' => '>=',
835
- // ),
825
+ // 'relation' => 'OR',
826
+ // array(
827
+ // 'key' => 'start_date',
828
+ // 'compare' => 'NOT EXISTS',
829
+ // ),
830
+ // array(
831
+ // 'key' => 'start_date',
832
+ // 'value' => gmdate( 'Y-m-d H:i:s' ),
833
+ // 'type' => 'DATETIME',
834
+ // 'compare' => '>=',
835
+ // ),
836
836
// ),
837
837
);
838
838
@@ -1098,13 +1098,13 @@ function utopia_acf_validate_lead( $valid, $value, $field ) {
1098
1098
1099
1099
// add_filter( 'acf/validate_value/key=field_66365be62f501', 'utopia_acf_validate_concert_content_field', 10, 3 );
1100
1100
// function utopia_acf_validate_concert_content_field( $valid, $value, $field ) {
1101
- // $value = preg_replace( '/\s+/', '', $value );
1101
+ // $value = preg_replace( '/\s+/', '', $value );
1102
1102
1103
- // if ( strlen( $value ) < 3 ) {
1104
- // return 'The concert field should be up to 3 characters without spaces.';
1105
- // }
1103
+ // if ( strlen( $value ) < 3 ) {
1104
+ // return 'The concert field should be up to 3 characters without spaces.';
1105
+ // }
1106
1106
1107
- // return true;
1107
+ // return true;
1108
1108
// }
1109
1109
1110
1110
add_filter ( 'acf/validate_value/key=field_6636398d8dd00 ' , 'utopia_acf_validate_role ' , 10 , 3 );
0 commit comments