diff --git a/assets/js/opalestate.js b/assets/js/opalestate.js index d53447b3..a1366df1 100755 --- a/assets/js/opalestate.js +++ b/assets/js/opalestate.js @@ -195,7 +195,7 @@ jQuery( document ).ready( function ( $ ) { } ); $( 'body' ) - // Star ratings for comments + // Star ratings for comments .on( 'click', '.comment-form-rating p.opalestate-stars a', function () { var $star = $( this ), $rating = $( this ).closest( '.comment-form-rating' ).find( '.opalestate_rating' ), @@ -224,26 +224,26 @@ jQuery( document ).ready( function ( $ ) { var window_width = $( window ).width(); - if (window_width < 768) { - $(".opalestate-sticky-column").trigger("sticky_kit:detach"); + if ( window_width < 768 ) { + $( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' ); } else { make_sticky(); } - $( window ).resize(function() { + $( window ).resize( function () { window_width = $( window ).width(); - if (window_width < 768) { - $(".opalestate-sticky-column").trigger("sticky_kit:detach"); + if ( window_width < 768 ) { + $( '.opalestate-sticky-column' ).trigger( 'sticky_kit:detach' ); } else { make_sticky(); } - }); + } ); function make_sticky() { - $(".opalestate-sticky-column").stick_in_parent(); + $( '.opalestate-sticky-column' ).stick_in_parent(); } //// @@ -577,17 +577,33 @@ jQuery( document ).ready( function ( $ ) { $( '.ajax-load-properties' ).delegate( '.pagination li', 'click', function () { var $content = $( this ).parents( '.ajax-load-properties' ); - $.ajax( { - type: 'POST', - url: opalesateJS.ajaxurl, - data: location.search.substr( 1 ) + '&action=get_agent_property&paged=' + $( this ).data( 'paged' ) + - '&id=' + $content.data( 'id' ), - success: function ( data ) { - if ( data ) { - $content.html( data ); + var type = $( this ).parents( '.ajax-load-properties' ).data( 'type' ); + if ( type === 'agent' ) { + $.ajax( { + type: 'POST', + url: opalesateJS.ajaxurl, + data: location.search.substr( 1 ) + '&action=get_agent_property&paged=' + $( this ).data( 'paged' ) + + '&id=' + $content.data( 'id' ), + success: function ( data ) { + if ( data ) { + $content.html( data ); + } } - } - } ); + } ); + } else if ( type === 'agency' ) { + $.ajax( { + type: 'POST', + url: opalesateJS.ajaxurl, + data: location.search.substr( 1 ) + '&action=get_agency_property&paged=' + $( this ).data( 'paged' ) + + '&id=' + $content.data( 'id' ), + success: function ( data ) { + if ( data ) { + $content.html( data ); + } + } + } ); + } + return false; } ); diff --git a/changelog.txt b/changelog.txt index fefbceb5..878f9e9e 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ += 1.3.9.1 - 2020-03-23 = +* Fixes - Single agency properties load more + = 1.3.9 - 2020-03-17 = * Fixes - Pending properties review * Fixes - Search form default value diff --git a/inc/ajax-functions.php b/inc/ajax-functions.php index 3892b379..2a7f0e1b 100755 --- a/inc/ajax-functions.php +++ b/inc/ajax-functions.php @@ -227,36 +227,36 @@ function opalestate_toggle_featured_property() { /** * load more properties by agency */ -add_action( 'wp_ajax_get_agency_property', 'opalestate_load_more_agency_property' ); -add_action( 'wp_ajax_nopriv_get_agency_property', 'opalestate_load_more_agency_property' ); - -function opalestate_load_more_agency_property() { - - - $post = [ - 'post_id' => 0, - 'paged' => 1, - 'user_id' => 13, - 'related' => '', - 'limit' => apply_filters( 'opalesate_agency_properties_limit', 5 ), - ]; - - $post = array_merge( $post, $_POST ); - extract( $post ); - - $user_id = get_post_meta( absint( $post_id ), OPALESTATE_AGENCY_PREFIX . 'user_id', true ); - $query = Opalestate_Query::get_agency_property( absint( $post_id ), absint( $user_id ), absint( $limit ), absint( $paged ) ); - - if ( $query->have_posts() ) : - while ( $query->have_posts() ) : $query->the_post(); ?> -