Output Location
-
Guys,
I have a problem. On a post a job page, when I choose a location, it doesn’t show up on the single job page. How to fix it, any help please?The page I need help with: [log in to see the link]
-
Maybe it’s showing location value from “company profile” location which I dissabled?
Yep, I believe that would be why, @waldymar.
How to fix it, any ideas?
According to Google, there’s no job location data saved in the job listing:
How did you prefill the locations field? Are you using a plugin for that?
I’m using a taxonomy. The taxonomy I did in 2 ways:
1. through a pods plugin (now active)
2. through a snippet (not active)
by the way, which way is more preferable?The code in the snippet is the following:
function gds_create_taxonomy_location() { register_taxonomy( 'location_listing', 'job_listing', array( 'labels' => array( 'name' => __( 'Locations' ), 'singular_name' => __( 'Location' ), 'search_items' => __( 'Search Location' ), 'all_items' => __( 'All Locations' ), 'edit_item' => __( 'Edit Location' ), 'update_item' => __( 'Update Location' ), 'add_new_item' => __( 'Add New Location' ), 'new_item_name' => __( 'New Location' ), 'menu_name' => __( 'Job Location' ), ), 'hierarchical' => false, 'rewrite' => array('slug' => 'location_listing'), ) ); } add_action('init', 'gds_create_taxonomy_location');
Then I did a code change for location frontend through a snippet:
add_filter( 'submit_job_form_fields', 'custom_location_field' ); // This is your function which takes the fields, modifies them, and returns them // You can see the fields which can be changed here: https://github.com/mikejolley/WP-Job-Manager/blob/master/includes/admin/class-wp-job-manager-writepanels.php function custom_location_field( $fields ) { // Here we target one of the job fields (location) and change it's placeholder $fields['job']['job_location']['type'] = "term-multiselect"; $fields['job']['job_location']['taxonomy'] = "location_listing"; $fields['job']['job_location']['placeholder'] = "Choose a location…"; $fields['job']['job_location']['description'] = ""; // And return the modified fields return $fields; }
Clever! However, unfortunately I can’t troubleshoot your custom code. I would suggest, though, that you look to make sure that it’s being saved to the job listings properly, in the database:
And you might want to check your WordPress error log to see if any of these errors show up:
Hope that helps.
Ufff, your links are appreciated. However, I’m not an expert in the field to read and understand them.
If I use my logic, I can retrieve the following situation:
1. I did some changes in functions.php through add_filter regarding the field job_location.
2. Then I updated theme or wordpress and probably changed have been incorporated
3. Now when I want to do changes for job_location, if I use add_filter method apply to ‘submit_job_form_fields’ it probably doesn’t fully work as previously I have already changed the initial code. Do I have to do changes to ‘custom_joblocation_submit_job_form_fields’?
Is my logic correct? If yes, how can find the exact name of supposed ‘custom_joblocation_submit_job_form_fields’?Hi!
Your code looks fine, at first glance. Beyond that, like I said, I can’t help you debug it. My suspicion though is that it’s not being saved properly to the database and isn’t being passed properly to our geolocation code. That’s why I suggest looking to see for the errors in your WordPress error log. If you still need help with your code, you may want to look into one of these services for help:
Thanks!
Understood, Richard! I checked the error log and you might be right:
[05-Jul-2019 18:58:09 UTC] PHP Warning: strtolower() expects parameter 1 to be string, array given in /home/jobmarke/test.job-cy.com/wp-content/plugins/wp-job-manager/includes/class-wp-job-manager-geocode.php on line 197 [05-Jul-2019 19:02:02 UTC] PHP Warning: strtolower() expects parameter 1 to be string, array given in /home/jobmarke/test.job-cy.com/wp-content/plugins/wp-job-manager/includes/class-wp-job-manager-geocode.php on line 197
Is it the problem with geocode?
Sorted it out. Instead of using taxonomy, I chose to use a simple dropdown. Thanks everyone for assistance, appreciate. Solved!
- The topic ‘Output Location’ is closed to new replies.