Update API

This commit is contained in:
Hoang Huu
2019-10-04 16:26:23 +07:00
parent 218c914e0d
commit cfd65c5aa4
7 changed files with 317 additions and 261 deletions

View File

@@ -1,39 +1,41 @@
<?php
global $post;
$agency_id = get_the_ID();
$limit = apply_filters( 'opalesate_agency_properties_limit', 5 );
$user_id = get_post_meta( $agency_id, OPALESTATE_AGENCY_PREFIX . 'user_id', true );
$agency_id = get_the_ID();
$limit = apply_filters( 'opalesate_agency_properties_limit', 5 );
$user_id = get_post_meta( $agency_id, OPALESTATE_AGENCY_PREFIX . 'user_id', true );
$query = Opalestate_Query::get_agency_property( $agency_id, $user_id , $limit );
$query = Opalestate_Query::get_agency_property( $agency_id, $user_id, $limit );
if( $query->have_posts() ) :
$id = rand();
?>
<div class="clearfix clear"></div>
<div class="opalestate-box-inner property-agency-section">
<h4 class="box-heading hide"><?php echo sprintf( esc_html__('My Properties', 'opalestate-pro'), $query->found_posts );?></h4>
<div class="opalestate-rows">
<div class="<?php echo apply_filters('opalestate_row_container_class', 'opal-row');?>" id="<?php echo esc_attr( $id ); ?>">
<?php while( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-lg-12 col-md-12 col-sm-12">
<?php echo opalestate_load_template_path( 'content-property-list-v2' ); ?>
</div>
<?php endwhile; ?>
</div>
<?php if( $query->max_num_pages > 1 ): ?>
<div class="w-pagination"><?php // echo $query->max_num_pages; // opalestate_pagination( $query->max_num_pages ); ?></div>
<div class="opalestate-load-more text-center" data-post_id="<?php echo $agency_id; ?>" data-action="get_agency_property" data-related="<?php echo esc_attr( $id ); ?>" data-numpage="<?php echo
$query->max_num_pages; ?>" data-paged="2"> <button class="btn btn-primary btn-3d"> <?php esc_html_e('Load More', 'opalestate-pro'); ?></button></div>
<?php endif; ?>
if ( $query->have_posts() ) :
$id = rand();
?>
<div class="clearfix clear"></div>
<div class="opalestate-box-inner property-agency-section">
<h4 class="box-heading hide"><?php echo sprintf( esc_html__( 'My Properties', 'opalestate-pro' ), $query->found_posts ); ?></h4>
<div class="opalestate-rows">
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>" id="<?php echo esc_attr( $id ); ?>">
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-lg-12 col-md-12 col-sm-12">
<?php echo opalestate_load_template_path( 'content-property-list-v2' ); ?>
</div>
<?php endwhile; ?>
</div>
<?php if ( $query->max_num_pages > 1 ): ?>
<div class="w-pagination"><?php // echo $query->max_num_pages; // opalestate_pagination( $query->max_num_pages ); ?></div>
<div class="opalestate-load-more text-center" data-post_id="<?php echo $agency_id; ?>" data-action="get_agency_property" data-related="<?php echo esc_attr( $id ); ?>"
data-numpage="<?php echo
$query->max_num_pages; ?>" data-paged="2">
<button class="btn btn-primary btn-3d"> <?php esc_html_e( 'Load More', 'opalestate-pro' ); ?></button>
</div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<?php else : ?>
<div class="opalestate-message">
<?php esc_html_e( 'My Agency has not any property yet.', 'opalestate-pro' ) ;?>
</div>
<?php endif; ?>
<div class="opalestate-message">
<?php esc_html_e( 'My Agency has not any property yet.', 'opalestate-pro' ); ?>
</div>
<?php endif; ?>
<?php wp_reset_postdata(); ?>
<?php wp_reset_postdata(); ?>

View File

@@ -1,29 +1,27 @@
<?php
global $post;
$limit = apply_filters( 'opalesate_agent_properties_limit', 10 );
$limit = apply_filters( 'opalesate_agent_properties_limit', 10 );
$query = Opalestate_Query::get_agent_property( null, get_the_ID(), $limit );
if( $query->have_posts() ) :
?>
<div class="clearfix clear"></div>
<div class="opalestate-box-content my-properties-section" id="block-my-properties">
<h4 class="outbox-title"><?php echo sprintf( esc_html__('My Properties', 'opalestate-pro'), $query->found_posts );?></h4>
<div class="ajax-load-properties" data-paged="1" data-type="agent" data-id="<?php echo get_the_ID(); ?>">
<div class="opalestate-rows">
<div class="<?php echo apply_filters('opalestate_row_container_class', 'opal-row');?>">
<?php while( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-lg-6 col-md-6 col-sm-12">
<?php echo opalestate_load_template_path( 'content-property-grid' ); ?>
</div>
<?php endwhile; ?>
</div>
</div>
<?php if( $query->max_num_pages > 1 ): ?>
<div class="w-pagination"><?php opalestate_pagination( $query->max_num_pages ); ?></div>
<?php endif; ?>
</div>
</div>
<?php endif;
wp_reset_postdata();
?>
if ( $query->have_posts() ) : ?>
<div class="clearfix clear"></div>
<div class="opalestate-box-content my-properties-section" id="block-my-properties">
<h4 class="outbox-title"><?php echo sprintf( esc_html__( 'My Properties', 'opalestate-pro' ), $query->found_posts ); ?></h4>
<div class="ajax-load-properties" data-paged="1" data-type="agent" data-id="<?php echo get_the_ID(); ?>">
<div class="opalestate-rows">
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>">
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<div class="col-lg-6 col-md-6 col-sm-12">
<?php echo opalestate_load_template_path( 'content-property-grid' ); ?>
</div>
<?php endwhile; ?>
</div>
</div>
<?php if ( $query->max_num_pages > 1 ): ?>
<div class="w-pagination"><?php opalestate_pagination( $query->max_num_pages ); ?></div>
<?php endif; ?>
</div>
</div>
<?php endif;
wp_reset_postdata();