Update dashbard properties.

This commit is contained in:
Hoang Huu 2019-09-25 17:07:35 +07:00
parent 82fa1a6d3d
commit 76feccd3d1
3 changed files with 66 additions and 60 deletions

View File

@ -1147,3 +1147,18 @@ function opalestate_get_measurement_units() {
'm2' => esc_html__( 'm2', 'opalestate-pro' ), 'm2' => esc_html__( 'm2', 'opalestate-pro' ),
] ); ] );
} }
/**
* Returns property statuses.
*
* @return array
*/
function opalestate_get_property_statuses() {
return apply_filters( 'opalestate_get_property_statuses', [
'all' => esc_html__( 'All', 'opalestate-pro' ),
'publish' => esc_html__( 'Published', 'opalestate-pro' ),
'published' => esc_html__( 'Published', 'opalestate-pro' ),
'pending' => esc_html__( 'Pending', 'opalestate-pro' ),
'expired' => esc_html__( 'Expired', 'opalestate-pro' ),
] );
}

View File

@ -6,21 +6,13 @@ if ( ! defined( 'ABSPATH' ) ) {
$property = opalesetate_property( get_the_ID() ); $property = opalesetate_property( get_the_ID() );
global $property, $post; global $property, $post;
$status = get_post_status( get_the_ID() );
$statuses = opalestate_get_property_statuses();
$meta = $property->get_meta_shortinfo(); $meta = $property->get_meta_shortinfo();
?> ?>
<article itemscope itemtype="http://schema.org/Property" <?php post_class( 'my-property-list' ); ?>> <article itemscope itemtype="http://schema.org/Property" <?php post_class( 'my-property-list' ); ?>>
<div class="property-list container-cols-2"> <div class="property-list container-cols-2">
<header> <header>
<div class="property-group-label">
<?php do_action( 'opalestate_before_property_loop_item' ); ?>
<?php if ( $property->featured != 1 ): ?>
<div class="property-toggle-featured hide" data-id="property-toggle-featured-<?php echo get_the_ID(); ?>">
<span class="label-featured label"><?php esc_html_e( 'Featured', 'opalestate-pro' ); ?></span>
</div>
<?php endif; ?>
</div>
<?php opalestate_get_loop_thumbnail( opalestate_get_option( 'loop_image_size', 'large' ) ); ?> <?php opalestate_get_loop_thumbnail( opalestate_get_option( 'loop_image_size', 'large' ) ); ?>
<div class="property-meta-bottom"> <div class="property-meta-bottom">
<?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?> <?php echo do_shortcode( '[opalestate_favorite_button property_id=' . get_the_ID() . ']' ); ?>
@ -49,7 +41,10 @@ $meta = $property->get_meta_shortinfo();
</div> </div>
<div class="my-properties-bottom"> <div class="my-properties-bottom">
<span class="label-post-status label <?php if ( $post->post_status == 'pending' ): ?> label-danger <?php else : ?> label-info <?php endif; ?>"> <?php echo get_post_status( get_the_ID() ) ?> </span> <span class="label-post-status label <?php if ( $post->post_status == 'pending' ): ?> label-danger <?php else : ?> label-info <?php endif; ?>"> <?php echo esc_html( isset(
$statuses[ $status ] ) ? $statuses[ $status ] : $status );
?>
</span>
</div> </div>
<div class="property-meta"> <div class="property-meta">
<ul class="property-meta-list list-inline"> <ul class="property-meta-list list-inline">
@ -91,7 +86,6 @@ $meta = $property->get_meta_shortinfo();
<?php <?php
} }
} ?> } ?>
</div> </div>
</div> </div>

View File

@ -1,10 +1,10 @@
<?php <?php
$statuses = array( $statuses = [
'all' => esc_html__( 'All', 'opalestate-pro' ), 'all' => esc_html__( 'All', 'opalestate-pro' ),
'published' => esc_html__( 'Published', 'opalestate-pro' ), 'published' => esc_html__( 'Published', 'opalestate-pro' ),
'pending' => esc_html__( 'Pending', 'opalestate-pro' ), 'pending' => esc_html__( 'Pending', 'opalestate-pro' ),
'expired' => esc_html__( 'Expired', 'opalestate-pro' ), 'expired' => esc_html__( 'Expired', 'opalestate-pro' ),
); ];
$gstatus = isset( $_GET['status'] ) ? $_GET['status'] : 'all'; $gstatus = isset( $_GET['status'] ) ? $_GET['status'] : 'all';
?> ?>
@ -16,7 +16,7 @@
<ul class="clearfix"> <ul class="clearfix">
<?php foreach ( $statuses as $status => $label ): ?> <?php foreach ( $statuses as $status => $label ): ?>
<li <?php if ( $status == $gstatus ): ?> class="active" <?php endif; ?>> <li <?php if ( $status == $gstatus ): ?> class="active" <?php endif; ?>>
<a href="<?php echo esc_url( opalestate_get_current_url( array( 'status' => $status) ) ); ?>" ><?php echo esc_attr($label); ?></a> <a href="<?php echo esc_url( opalestate_get_current_url( [ 'status' => $status ] ) ); ?>"><?php echo esc_attr( $label ); ?></a>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
@ -24,19 +24,16 @@
</div> </div>
<div class="opalestate-admin-box"> <div class="opalestate-admin-box">
<div class="box-content"> <div class="box-content">
<?php if ( $loop->have_posts() ): ?> <?php if ( $loop->have_posts() ): ?>
<div class="opalestate-rows"> <div class="opalestate-rows">
<div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>"> <div class="<?php echo apply_filters( 'opalestate_row_container_class', 'opal-row' ); ?>">
<?php $cnt=0; while ( $loop->have_posts() ) : $loop->the_post(); global $post; ?> <?php $cnt = 0;
while ( $loop->have_posts() ) : $loop->the_post();
global $post; ?>
<div class="col-lg-12 col-md-12 col-sm-12"> <div class="col-lg-12 col-md-12 col-sm-12">
<?php echo opalestate_load_template_path( 'user/content-property' ); ?> <?php echo opalestate_load_template_path( 'user/content-property' ); ?>
</div> </div>
<?php endwhile; ?> <?php endwhile; ?>
</div> </div>
</div> </div>
@ -51,4 +48,4 @@
</div> </div>
</div> </div>
<?php wp_reset_postdata(); ?> <?php wp_reset_postdata(); ?>
<?php do_action( "opalestate_submission_listing_after" ); ?> <?php do_action( 'opalestate_submission_listing_after' ); ?>