• Resolved adam1234567

    (@adam1234567)


    Hello –

    When an employer submits a job and inputs a full address it’s too long for the job results page and doesn’t look good.

    I am using GEO Job Manager and it automatically creates custom fields from the address. geolocation_city pulls the city and geolocation_state_short pulls the abbreviated state name (e.g. NY).

    How can I display City, State (abbreviated) pulling info from these two fields on both the job listing search/results page and individual job listing?

    Thank you.

    https://wordpress.org/plugins/wp-job-manager/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mike Jolley

    (@mikejolley)

    Presumably these geo location values are stored in post meta. You can filter the location via:

    return apply_filters( 'the_job_location', $post->_job_location, $post );

    So something like:

    function custom_job_location( $text, $post ) {
      return get_post_meta( $post->ID, 'CUSTOMFIELDNAME', true );
    }
    
    add_filter( 'the_job_location', 'custom_job_location', 10, 2 );
    Thread Starter adam1234567

    (@adam1234567)

    thanks – where would I put this function (which file) and how would I display both values with a comma after the first one (custom fields again are geolocation_city and geolocation_state_short)

    Plugin Author Mike Jolley

    (@mikejolley)

    Your theme functions.php

    You could try:

    return get_post_meta( $post->ID, 'geolocation_city', true ) . ', ' . get_post_meta( $post->ID, 'geolocation_state_short', true );
    Thread Starter adam1234567

    (@adam1234567)

    awesome, works great! thanks so much 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Pull geo city/state data for location display’ is closed to new replies.