diff --git a/includes/model/ListingAuthor.php b/includes/model/ListingAuthor.php index 8a44971114..aa4e9379c7 100644 --- a/includes/model/ListingAuthor.php +++ b/includes/model/ListingAuthor.php @@ -238,16 +238,18 @@ public function author_listings_query() { } public function avatar_html() { - $html = ''; - $author_id = $this->id; - $u_pro_pic = get_user_meta( $author_id, 'pro_pic', true ); - - if ( !empty( $u_pro_pic ) ) { + $html = ''; + $author_id = $this->id; + $u_pro_pic = get_user_meta( $author_id, 'pro_pic', true ); + $author_data = get_userdata( $author_id ); + $display_name = ! empty( $author_data->display_name ) ? $author_data->display_name : ''; + + if ( ! empty( $u_pro_pic ) ) { $html = wp_get_attachment_image( $u_pro_pic ); } - if ( !$html ) { - $html = get_avatar( $author_id ); + if ( ! $html ) { + $html = get_avatar( $author_id, 96, '', $display_name ); } return $html; diff --git a/includes/model/Listings.php b/includes/model/Listings.php index d77e529ac9..a97ff490cf 100644 --- a/includes/model/Listings.php +++ b/includes/model/Listings.php @@ -396,12 +396,13 @@ public function set_loop_data() { $author_id = get_the_author_meta( 'ID' ); $author_data = get_userdata( $author_id ); - $author_first_name = ! empty( $author_data ) ? $author_data->first_name : ''; - $author_last_name = ! empty( $author_data ) ? $author_data->last_name : ''; + $author_first_name = ! empty( $author_data ) ? $author_data->first_name : ''; + $author_last_name = ! empty( $author_data ) ? $author_data->last_name : ''; + $author_display_name = ! empty( $author_data->display_name ) ? $author_data->display_name : ''; - $u_pro_pic = get_user_meta( $author_id, 'pro_pic', true ); - $u_pro_pic = ! empty( $u_pro_pic ) ? wp_get_attachment_image_src( $u_pro_pic, 'thumbnail' ) : ''; - $bdbh = get_post_meta( $id, '_bdbh', true ); + $u_pro_pic = get_user_meta( $author_id, 'pro_pic', true ); + $u_pro_pic = ! empty( $u_pro_pic ) ? wp_get_attachment_image_src( $u_pro_pic, 'thumbnail' ) : ''; + $bdbh = get_post_meta( $id, '_bdbh', true ); $listing_type = $this->current_listing_type; @@ -434,7 +435,7 @@ public function set_loop_data() { 'author_link' => ATBDP_Permalink::get_user_profile_page_link( $author_id, $directory_type ), 'author_link_class' => ! empty( $author_first_name && $author_last_name ) ? 'atbd_tooltip' : '', 'u_pro_pic' => $u_pro_pic, - 'avatar_img' => get_avatar( $author_id, apply_filters( 'atbdp_avatar_size', 32 ) ), + 'avatar_img' => get_avatar( $author_id, apply_filters( 'atbdp_avatar_size', 32 ), '', $author_display_name ), 'review' => $this->get_review_data(), ); } @@ -1634,43 +1635,58 @@ function loop_get_the_thumbnail( $class = '' ) { $listing_prv_img = get_post_meta($id, '_listing_prv_img', true); $listing_img = get_post_meta($id, '_listing_img', true); $thumbnail_img_id = array_filter( array_merge( (array) $listing_prv_img, (array) $listing_img ) ); + $link_start = ''; + $link_end = ''; if ( empty( $thumbnail_img_id ) ) { $thumbnail_img_id = $default_image_src; - $image_alt = esc_html( get_the_title( $id ) ); - return "$image_alt"; + $image_alt = esc_html( get_the_title( $id ) ); + $image = "$image_alt"; + if ( ! $this->disable_single_listing ) { + $image = $link_start . $image . $link_end; + } + return $image; } $image_count = count( $thumbnail_img_id ); if ( 1 === (int) $image_count ) { - $image_src = atbdp_get_image_source( reset( $thumbnail_img_id ), $image_quality ); - $image_alt = get_post_meta( reset( $thumbnail_img_id ), '_wp_attachment_image_alt', true ); - $image_alt = ( ! empty( $image_alt ) ) ? esc_attr( $image_alt ) : esc_html( get_the_title( reset( $thumbnail_img_id ) ) ); - - return "$image_alt"; - + $image_src = atbdp_get_image_source( reset( $thumbnail_img_id ), $image_quality ); + $image_alt = get_post_meta( reset( $thumbnail_img_id ), '_wp_attachment_image_alt', true ); + $image_alt = ( ! empty( $image_alt ) ) ? esc_attr( $image_alt ) : esc_html( get_the_title( reset( $thumbnail_img_id ) ) ); + $image = "$image_alt"; + if ( ! $this->disable_single_listing ) { + $image = $link_start . $image . $link_end; + } + return $image; } else { - ob_start(); - echo "
-
"; - foreach ( $thumbnail_img_id as $img_id ) { + $output = "
+
"; + + foreach ( $thumbnail_img_id as $img_id ) { $image_src = atbdp_get_image_source( $img_id, $image_quality ); - $image_alt = get_post_meta($img_id, '_wp_attachment_image_alt', true); - $image_alt = ( ! empty( $image_alt ) ) ? esc_attr( $image_alt ) : esc_html( get_the_title( $img_id ) ); - echo "
- $image_alt -
"; + $image_alt = get_post_meta( $img_id, '_wp_attachment_image_alt', true ); + $image_alt = ! empty( $image_alt ) ? esc_attr( $image_alt ) : esc_html( get_the_title( $img_id ) ); + $image = "$image_alt"; + + if ( ! $this->disable_single_listing ) { + $image = $link_start . $image . $link_end; + } + + $output .= "
$image
"; } - echo "
-
-
".directorist_icon('las la-angle-left', false)."
-
".directorist_icon('las la-angle-right', false)."
-
- -
-
"; - return ob_get_clean(); + + $output .= "
+
+
" . directorist_icon( 'las la-angle-left', false ) . "
+
" . directorist_icon( 'las la-angle-right', false ) . "
+
+ +
+
"; + + return $output; + } } diff --git a/templates/archive/fields/posted_date.php b/templates/archive/fields/posted_date.php index c834288a2b..74241169c1 100644 --- a/templates/archive/fields/posted_date.php +++ b/templates/archive/fields/posted_date.php @@ -6,11 +6,12 @@ */ if ( ! defined( 'ABSPATH' ) ) exit; +$container_element = $listings->view === 'list' ? 'div' : 'li'; ?> -
  • +< class="directorist-listing-card-posted-on"> loop_get_published_date( $data ) );?> -
  • \ No newline at end of file +> \ No newline at end of file diff --git a/templates/archive/fields/thumb-card.php b/templates/archive/fields/thumb-card.php index 0777aa4137..3337707277 100644 --- a/templates/archive/fields/thumb-card.php +++ b/templates/archive/fields/thumb-card.php @@ -2,7 +2,7 @@ /** * @author wpWax * @since 6.6 - * @version 7.7.0 + * @version 8.0 */ if ( ! defined( 'ABSPATH' ) ) exit; @@ -74,12 +74,4 @@ $link_start = ''; $link_end = ''; -if (!$listings->disable_single_listing) { - echo wp_kses_post( $link_start ); -} - echo wp_kses_post( $the_html ); - -if (!$listings->disable_single_listing) { - echo wp_kses_post( $link_end ); -} \ No newline at end of file diff --git a/templates/search-form/fields/email.php b/templates/search-form/fields/email.php index 643515bed7..42557dc218 100644 --- a/templates/search-form/fields/email.php +++ b/templates/search-form/fields/email.php @@ -11,10 +11,10 @@
    - + - > + >
    diff --git a/templates/search-form/fields/fax.php b/templates/search-form/fields/fax.php index c810e55915..aacc7bc709 100644 --- a/templates/search-form/fields/fax.php +++ b/templates/search-form/fields/fax.php @@ -11,10 +11,10 @@
    - + - > + >
    diff --git a/templates/search-form/fields/phone.php b/templates/search-form/fields/phone.php index 9c6e93d1ed..c60535113a 100644 --- a/templates/search-form/fields/phone.php +++ b/templates/search-form/fields/phone.php @@ -11,10 +11,10 @@
    - + - > + >
    diff --git a/templates/search-form/fields/phone2.php b/templates/search-form/fields/phone2.php index 4ce7f60e54..5069a0753d 100644 --- a/templates/search-form/fields/phone2.php +++ b/templates/search-form/fields/phone2.php @@ -11,10 +11,10 @@
    - + - > + >
    diff --git a/templates/search-form/fields/title.php b/templates/search-form/fields/title.php index 7ccb382b3b..7b4d6ffc2d 100644 --- a/templates/search-form/fields/title.php +++ b/templates/search-form/fields/title.php @@ -13,10 +13,10 @@
    - + - > + >
    diff --git a/templates/search-form/fields/website.php b/templates/search-form/fields/website.php index 27c9816b0c..fd590a9c0b 100644 --- a/templates/search-form/fields/website.php +++ b/templates/search-form/fields/website.php @@ -11,10 +11,10 @@
    - + - > + >
    diff --git a/templates/search-form/fields/zip.php b/templates/search-form/fields/zip.php index 8abbdb81b6..4fec1ba7f8 100644 --- a/templates/search-form/fields/zip.php +++ b/templates/search-form/fields/zip.php @@ -13,10 +13,10 @@