Fix featured toggle not working
Hacky implementation, but it does the job.
This commit is contained in:
parent
440e7fc604
commit
4b8fc83816
@ -208,13 +208,16 @@ function opalestate_toggle_featured_property() {
|
|||||||
|
|
||||||
if ( $post->post_author == $user_id ) {
|
if ( $post->post_author == $user_id ) {
|
||||||
|
|
||||||
$check = apply_filters( 'opalestate_set_feature_property_checked', false );
|
$isfeatured = get_post_meta( $property_id, OPALESTATE_PROPERTY_PREFIX . 'featured', true );
|
||||||
if ( $check ) {
|
if( $isfeatured ) {
|
||||||
do_action( 'opalestate_toggle_featured_property_before', $user_id, $property_id );
|
update_post_meta( $property_id, OPALESTATE_PROPERTY_PREFIX . 'featured', '' );
|
||||||
update_post_meta( $property_id, OPALESTATE_PROPERTY_PREFIX . 'featured', 'on' );
|
echo json_encode( [ 'status' => false, 'msg' => esc_html__( 'Immobile tolto da evidenza', 'opalestate-pro' ) ] );
|
||||||
echo json_encode( [ 'status' => true, 'msg' => esc_html__( 'Could not set this as featured', 'opalestate-pro' ) ] );
|
wp_die();
|
||||||
wp_die();
|
} else {
|
||||||
}
|
update_post_meta( $property_id, OPALESTATE_PROPERTY_PREFIX . 'featured', 'on' );
|
||||||
|
echo json_encode( [ 'status' => false, 'msg' => esc_html__( 'Immobile messo in evidenza', 'opalestate-pro' ) ] );
|
||||||
|
wp_die();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode( [ 'status' => false, 'msg' => esc_html__( 'Could not set this as featured', 'opalestate-pro' ) ] );
|
echo json_encode( [ 'status' => false, 'msg' => esc_html__( 'Could not set this as featured', 'opalestate-pro' ) ] );
|
||||||
|
Loading…
Reference in New Issue
Block a user