Your address will show here +12 34 56 78

Home Forums WP RESIDENCE – Real Estate WordPress Theme FORUM How City and Area connection is coded in WP RESIDENCE

This topic contains 0 replies, has 1 voice, and was last updated by  Camelia Support Team – WP Estate 2 years, 4 months ago.

  • Author
    Posts
  • #109403

    In our theme City—> Area are the only connected taxonomies.

    For connect more taxonomies is required new code.

    We recommend you to take as example the relation between our taxonomies State-Area.

    The code for relation between our taxonomies State-Area is in property.php line 967-

    these are the filters and functions used to sort areas by city

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////

    // Tie area with city

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////

    
    add_action( 'property_area_edit_form_fields', 'property_area_callback_function', 10, 2);
    
    add_action( 'property_area_add_form_fields', 'property_area_callback_add_function', 10, 2 );
    
    add_action( 'created_property_area', 'property_area_save_extra_fields_callback', 10, 2);
    
    add_action( 'edited_property_area', 'property_area_save_extra_fields_callback', 10, 2);
    
    add_filter('manage_edit-property_area_columns', 'ST4_columns_head');
    
    add_filter('manage_property_area_custom_column','ST4_columns_content_taxonomy', 10, 3);

    ———-

    Can you please explain where you have added the ajax codes for showing areas corresponding to a particular city.

    This is done via javascript – look into control.js around line 900

    ////////////////////////////////////////////////////////////////////////////////////////////
    
    ///city-area-selection
    
    ///////////////////////////////////////////////////////////////////////////////////////////
    
    $('#filter_city li').click(function(event){
    
    event.preventDefault();
    
    var pick, value_city, parent, selected_city, is_city, area_value;
    
    value_city = String( $(this).attr('data-value2') ).toLowerCase();
    
    $('#filter_area li').each(function(){
    
    is_city = String ( $(this).attr('data-parentcity') ).toLowerCase();
    
    is_city = is_city.replace(" ","-");
    
    area_value = String ( $(this).attr('data-value') ).toLowerCase();
    
    if(is_city === value_city || value_city === 'all' ){
    
    $(this).show();
    
    }else{
    
    $(this).hide();
    
    }
    
    });
    
    });

    Thanks

    • This topic was modified 2 years, 4 months ago by  Camelia Support Team - WP Estate.
    • This topic was modified 2 years, 4 months ago by  Anna.
    • This topic was modified 2 years, 4 months ago by  Anna.

You must be logged in to reply to this topic.