Update template.

This commit is contained in:
Hoang Huu 2019-10-08 17:18:48 +07:00
parent 7c953687ae
commit 7b67843a52
2 changed files with 34 additions and 31 deletions

@ -94,6 +94,24 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
// ], // ],
] ]
); );
register_rest_route(
$this->namespace,
'/' . $this->base . '/search/',
[
'args' => [
'id' => [
'description' => __( 'Unique identifier for the resource.', 'opalestate-pro' ),
'type' => 'integer',
],
],
[
'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_results' ],
// 'permission_callback' => [ $this, 'get_item_permissions_check' ],
],
]
);
} }
/** /**

@ -1,7 +1,6 @@
<?php if ( $author ): ?> <?php if ( $author ): ?>
<div class="property-agent-contact "> <div class="property-agent-contact ">
<?php <?php
if ( ! isset( $prefix ) ) { if ( ! isset( $prefix ) ) {
$prefix = OPALESTATE_USER_PROFILE_PREFIX; $prefix = OPALESTATE_USER_PROFILE_PREFIX;
} }
@ -18,28 +17,15 @@
$related = get_user_meta( $user_id, $prefix . 'related_id', true ); $related = get_user_meta( $user_id, $prefix . 'related_id', true );
$trusted = false; $trusted = false;
if ( in_array( 'opalestate_agency', $roles ) || in_array( 'opalestate_agent', $roles ) ) {
$post = get_post( $related ); $post = get_post( $related );
if ( ( in_array( 'opalestate_agency', $roles ) || in_array( 'opalestate_agent', $roles ) ) && $related && $post ) {
$link = get_permalink( $related ); $link = get_permalink( $related );
$author_name = $post->post_title; $author_name = $post->post_title;
if ( $post->post_type == 'opalestate_agency' ) { if ( $post->post_type == 'opalestate_agency' ) {
$prefixs = OPALESTATE_AGENCY_PREFIX; $prefixs = OPALESTATE_AGENCY_PREFIX;
$picture = OpalEstate_Agency::get_avatar_url( $post->ID , 'full' ); $picture = OpalEstate_Agency::get_avatar_url( $post->ID, 'full' );
} else {
$prefixs = OPALESTATE_AGENT_PREFIX;
$picture = OpalEstate_Agent::get_avatar_url( $post->ID , 'full' );
}
$trusted = get_post_meta( $related, $prefixs . 'trusted', true );
} elseif ( $related ) {
$post = get_post( $related );
$link = get_permalink( $related );
$author_name = $post->post_title;
if ( $post->post_type == 'opalestate_agency' ) {
$prefixs = OPALESTATE_AGENCY_PREFIX;
$picture = OpalEstate_Agency::get_avatar_url( $post->ID , 'full' );
} else { } else {
$prefixs = OPALESTATE_AGENT_PREFIX; $prefixs = OPALESTATE_AGENT_PREFIX;
$picture = OpalEstate_Agent::get_avatar_url( $post->ID, 'full' ); $picture = OpalEstate_Agent::get_avatar_url( $post->ID, 'full' );
@ -52,7 +38,6 @@
$trusted = get_user_meta( $user_id, $prefix . 'trusted', true ); $trusted = get_user_meta( $user_id, $prefix . 'trusted', true );
$picture = OpalEstate_User::get_author_picture( $user_id ); $picture = OpalEstate_User::get_author_picture( $user_id );
} }
?> ?>
<div class="agent-box"> <div class="agent-box">
@ -71,12 +56,12 @@
<img src="<?php echo esc_url( $picture ); ?>" title="<?php echo esc_attr( $author_name ); ?>"> <img src="<?php echo esc_url( $picture ); ?>" title="<?php echo esc_attr( $author_name ); ?>">
</a> </a>
</div> </div>
</div><!-- /.agent-preview --> </div>
<div class="agent-box-meta"> <div class="agent-box-meta">
<h4 class="agent-box-title"> <h4 class="agent-box-title">
<a href="<?php echo esc_url( $link ); ?>"><?php echo esc_html( $author_name ); ?></a> <a href="<?php echo esc_url( $link ); ?>"><?php echo esc_html( $author_name ); ?></a>
</h4><!-- /.agent-box-title --> </h4>
<?php <?php
$job = get_user_meta( $user_id, $prefix . 'job', true ); $job = get_user_meta( $user_id, $prefix . 'job', true );
@ -90,14 +75,14 @@
<a href="mailto:<?php echo esc_attr( $email ); ?>"> <a href="mailto:<?php echo esc_attr( $email ); ?>">
<span><?php echo esc_attr( $email ); ?></span> <span><?php echo esc_attr( $email ); ?></span>
</a> </a>
</div><!-- /.agent-box-email --> </div>
<?php endif; ?> <?php endif; ?>
<?php $phone = get_user_meta( $user_id, $prefix . 'phone', true ); ?> <?php $phone = get_user_meta( $user_id, $prefix . 'phone', true ); ?>
<?php if ( ! empty( $phone ) ) : ?> <?php if ( ! empty( $phone ) ) : ?>
<div class="agent-box-phone"> <div class="agent-box-phone">
<i class="fa fa-phone"></i><span><a href="tel:<?php echo sanitize_title( $phone ); ?>"><?php echo esc_attr( $phone ); ?></a></span> <i class="fa fa-phone"></i><span><a href="tel:<?php echo sanitize_title( $phone ); ?>"><?php echo esc_attr( $phone ); ?></a></span>
</div><!-- /.agent-box-phone --> </div>
<?php endif; ?> <?php endif; ?>
<?php $web = get_user_meta( $user_id, $prefix . 'web', true ); ?> <?php $web = get_user_meta( $user_id, $prefix . 'web', true ); ?>
@ -107,7 +92,7 @@
<a href="<?php echo esc_attr( $web ); ?>"> <a href="<?php echo esc_attr( $web ); ?>">
<span><?php echo esc_attr( $web ); ?></span> <span><?php echo esc_attr( $web ); ?></span>
</a> </a>
</div><!-- /.agent-box-web --> </div>
<?php endif; ?> <?php endif; ?>
<?php <?php
@ -121,24 +106,24 @@
<div class="opalestate-social-icons"> <div class="opalestate-social-icons">
<?php if ( $facebook && $facebook != "#" && ! empty( $facebook ) ) { ?> <?php if ( $facebook && $facebook != "#" && ! empty( $facebook ) ) { ?>
<a class="opalestate-social-white radius-x" href="<?php echo esc_url( $facebook ); ?>"> <i class="fab fa-facebook"></i> </a> <a class="opalestate-social-white radius-x" href="<?php echo esc_url( $facebook ); ?>" target="_blank"> <i class="fab fa-facebook"></i> </a>
<?php } ?> <?php } ?>
<?php if ( $twitter && $twitter != "#" && ! empty( $twitter ) ) { ?> <?php if ( $twitter && $twitter != "#" && ! empty( $twitter ) ) { ?>
<a class="opalestate-social-white radius-x" href="<?php echo esc_url( $twitter ); ?>"><i class="fab fa-twitter"></i> </a> <a class="opalestate-social-white radius-x" href="<?php echo esc_url( $twitter ); ?>" target="_blank"><i class="fab fa-twitter"></i> </a>
<?php } ?> <?php } ?>
<?php if ( $pinterest && $pinterest != "#" && ! empty( $pinterest ) ) { ?> <?php if ( $pinterest && $pinterest != "#" && ! empty( $pinterest ) ) { ?>
<a class="opalestate-social-white radius-x" href="<?php echo esc_url( $pinterest ); ?>"><i class="fab fa-pinterest"></i> </a> <a class="opalestate-social-white radius-x" href="<?php echo esc_url( $pinterest ); ?>" target="_blank"><i class="fab fa-pinterest"></i> </a>
<?php } ?> <?php } ?>
<?php if ( $google && $google != "#" && ! empty( $google ) ) { ?> <?php if ( $google && $google != "#" && ! empty( $google ) ) { ?>
<a class="opalestate-social-white radius-x" href="<?php echo esc_url( $google ); ?>"> <i class="fab fa-google-plus"></i></a> <a class="opalestate-social-white radius-x" href="<?php echo esc_url( $google ); ?>" target="_blank"> <i class="fab fa-google-plus"></i></a>
<?php } ?> <?php } ?>
<?php if ( $instagram && $instagram != "#" && ! empty( $instagram ) ) { ?> <?php if ( $instagram && $instagram != "#" && ! empty( $instagram ) ) { ?>
<a class="opalestate-social-white radius-x" href="<?php echo esc_url( $instagram ); ?>"> <i class="fab fa-instagram"></i></a> <a class="opalestate-social-white radius-x" href="<?php echo esc_url( $instagram ); ?>" target="_blank"> <i class="fab fa-instagram"></i></a>
<?php } ?> <?php } ?>
<?php if ( $linkedIn && $linkedIn != "#" && ! empty( $linkedIn ) ) { ?> <?php if ( $linkedIn && $linkedIn != "#" && ! empty( $linkedIn ) ) { ?>
<a class="opalestate-social-white radius-x" href="<?php echo esc_url( $linkedIn ); ?>"> <i class="fab fa-linkedIn"></i></a> <a class="opalestate-social-white radius-x" href="<?php echo esc_url( $linkedIn ); ?>" target="_blank"> <i class="fab fa-linkedIn"></i></a>
<?php } ?> <?php } ?>
</div> </div>
</div><!-- /.agent-box-content --> </div><!-- /.agent-box-content -->