This commit is contained in:
ThemeLexus 2019-10-03 10:10:43 +07:00
parent a11080d387
commit a293bed116
3 changed files with 13 additions and 8 deletions

@ -114,10 +114,10 @@ class OpalEstate_Agency {
/**
* Get url of user avatar by agency id
*/
public static function get_avatar_url( $userID ) {
public static function get_avatar_url( $userID, $size='thumbnail' ) {
$id = get_post_meta( $userID, OPALESTATE_AGENCY_PREFIX . 'avatar_id', true );;
$url = wp_get_attachment_image_url( $id, 'thumbnail' );
$url = wp_get_attachment_image_url( $id, $size );
if( $url ) {
return $url;

@ -87,8 +87,13 @@ class OpalEstate_Agent {
/**
* Get url of user avatar by agent id
*/
public static function get_avatar_url( $userID ) {
return get_post_meta( $userID, OPALESTATE_AGENT_PREFIX . "avatar", true );
public static function get_avatar_url( $userID, $size='thumbnail' ) {
$id = get_post_meta( $userID, OPALESTATE_AGENT_PREFIX . 'avatar_id', true );;
$url = wp_get_attachment_image_url( $id, $size );
if( $url ) {
return $url;
}
}
/**

@ -25,10 +25,10 @@
if ( $post->post_type == 'opalestate_agency' ) {
$prefixs = OPALESTATE_AGENCY_PREFIX;
$picture = OpalEstate_Agency::get_avatar_url( $post->ID );
$picture = OpalEstate_Agency::get_avatar_url( $post->ID , 'full' );
} else {
$prefixs = OPALESTATE_AGENT_PREFIX;
$picture = OpalEstate_Agent::get_avatar_url( $post->ID );
$picture = OpalEstate_Agent::get_avatar_url( $post->ID , 'full' );
}
$trusted = get_post_meta( $related, $prefixs . 'trusted', true );
@ -39,10 +39,10 @@
if ( $post->post_type == 'opalestate_agency' ) {
$prefixs = OPALESTATE_AGENCY_PREFIX;
$picture = OpalEstate_Agency::get_avatar_url( $post->ID );
$picture = OpalEstate_Agency::get_avatar_url( $post->ID , 'full' );
} else {
$prefixs = OPALESTATE_AGENT_PREFIX;
$picture = OpalEstate_Agent::get_avatar_url( $post->ID );
$picture = OpalEstate_Agent::get_avatar_url( $post->ID, 'full' );
}
$trusted = get_post_meta( $related, $prefixs . 'trusted', true );