Thanks for your post,
we already have plan to add multiple locations for single job, but currently, support one location,
if you already installed “Job Board Manager – Locations” addon for “Job Board Manager”
https://ww.wp.xz.cn/plugins/job-board-manager-locations/
for the display purpose, only you could use comma separated location name on location field,
View post on imgur.com
Hope future version display separated link for each comma separate location value
View post on imgur.com
And so on other integration,
Feee free to share some ideas will try.
Regards
Hi
Thanks for the answer,
I’ve followed your advice and just optimized it.
in the file job-board-manager-locations/assets/admin/js/scripts.js
jQuery(document).ready(function($)
{
$("#job_bm_location").attr('autocomplete','off');
$("#job_bm_location").wrap("<div id='location-list-wrapper'></div>");
$("#location-list-wrapper").append("<div id='location-list'></div>");
$(document).on('keyup', '#job_bm_location', function()
{
var name = $(this).val();
name = name.split(',');
name = name[name.length-1];
console.log(name);
if(name=='' || name == null){
$("#location-list").html('<div value="" class="item">Start Typing...<div>');
}
else{
$.ajax(
{
type: 'POST',
context: this,
url:job_bm_locations_ajax.job_bm_locations_ajaxurl,
data: {"action": "job_bm_locations_ajax_job_location_list", "name":name,},
success: function(data)
{
$("#location-list").html(data);
}
});
}
})
$(document).on('click', '#location-list .item', function(){
var oldval = $('#job_bm_location').val();
var inputVal = oldval.split(',');
var newVal ='';
for (var i = 0; i < inputVal.length-1; i++) {
if (newVal=='') {
newVal = inputVal[i];
}else{
newVal = newVal+','+inputVal[i];
}
}
var name = $(this).attr('location-data');
if (newVal=='') {
newVal = name;
}else{
newVal = newVal+','+name;
}
$("#job_bm_location").val(newVal);
})
});
So, if I write a comma after the text it browses again into all locations post, and i can choose one.
And to display i’ve done this in job-board-manager/templates/job-single-sidebar.php
if(!empty($job_bm_location)){
$job_bm_location = split(',', $job_bm_location);
foreach ($job_bm_location as $location) {
$html_about_company .= '<div itemprop="jobLocation" itemscope itemtype="http://schema.org/Place" class="side-meta location"><i class="fa fa-map-marker"></i> '.$location.'</div>';
}
}
Now, i just have to look at my ajax research to make it work with this
hope it can help somebody 🙂