• Resolved markpetherbridge

    (@markpetherbridge)


    Hey

    Ive created a custom hook so that when I publish a new job it fires. I’m ok getting the values stored in the global $post but can you tell me how I would get these values:

    1) Job Type textfield
    2) Freature this job checkbox value
    3) Company Name textfield

    in this function:

    function createDashboardWidget($ID, $post ) {
    
     }
    add_action( 'publish_job_listing', 'createDashboardWidget', 10, 2 );

    Much Appreciated.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey Mark,

    Can definitely help 🙂

    1. To get the job type you can use:

    $job_type = get_the_job_type( $post_id );

    2. Where $post_id is the ID of the job listing.

    To see if a listing is featured use:

    $featured = get_post_meta( $post_id, '_featured', true );

    If $featured == 1 then the listing is featured.

    3. To get the company name you can use the_company_name() or output get_ the_company_name() in your template files or retrieve the meta get_post_meta and the ‘_company_name’ key.

    Hope this helps!

    Kind Regards,
    Scott

    Thread Starter markpetherbridge

    (@markpetherbridge)

    Scott, This doesnt help. Those work outside of the above function what i am needing is for the variables to be pulled out within the function so I can utilise them.

    Plugin Author Mike Jolley

    (@mikejolley)

    Mark, those functions scott mentioned will work because your function is passed the ID of the job. Just replace his use of $post_id with $ID

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

The topic ‘Get extra meta data on submission’ is closed to new replies.