Job Posting Meta Display in PHP

  • Hi,
    I want to print Job posting data on the archive page, For example I want to display Title, Description, Last Date, Organization, and Salary in a single Job Archive card so how it possible?
    It is possible as we display Breadcrumb by PHP in backend single.php file.
    Like we use <?php if (function_exists('rank_math_the_breadcrumbs')) rank_math_the_breadcrumbs(); ?> to show breadcrumb, so like
    this code how to display Job Posting Data (Above Mention data which I want to use in archieve.php) that we created in Single Posts.
    Thank You

Viewing 15 replies - 1 through 15 (of 16 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    What do you mean with the “Job Posting card”? Could you share a screenshot showing us where you would like to display that information?

    Looking forward to helping you. Thank you.


    I mean all the information that we fill in job posting fields is displayed in Google Jobs SERP. So like that, I want to display similar data in the archive page using job posting data.
    I want to use Title, Description, Last Date, Organization, and Salary, Job Type fields instead of Category, Comment, Admin, Date, fields in the archive.

    How can I print data of rank math job posting fields in PHP?



    We are so sorry but it is not possible with Rank Math. You may have to custom code that or hire a developer that can do it for you.

    I can do it, if you provide me code by which job posting values stored and execute in the Head.


    You could try using and looking for the meta fields you need.

    After that, using the you could access each post meta fields and print them as you want.

    Looking forward to help you.

    It works but results are as follow:

    • <?php $item = get_post_meta($post->ID, ‘rank_math_snippet_jobposting_organization’, true); ?>
      <?php print_r( $item ); ?>
    • Output – Google India [Result As I want to display]
    • <?php $item = get_post_meta($post->ID, ‘rank_math_snippet_jobposting_address’, false); ?>
      <?php print_r( $item ); ?>

    • Output – Array ( [0] => Array ( [streetAddress] => Noida, New Delhi [addressLocality] => New Delhi [addressRegion] => New Delhi [postalCode] => 110001 [addressCountry] => India ))
    • I want to display only Noida, New Delhi {StreetAddress} & 110001 {PostalCode}


    I think you will need then to process the var before printing them in your HTML. Maybe using some code to just select a part of the text you want from the returned array.

    Looking forward to help you.

    Can you provide me exact code or where to use var?


    For this one: “Output – Array ( [0] => Array ( [streetAddress] => Noida, New Delhi [addressLocality] => New Delhi [addressRegion] => New Delhi [postalCode] => 110001 [addressCountry] => India ))”, you can use this code:

    <?php $item = get_post_meta($post->ID, ‘rank_math_snippet_jobposting_address’, false);
     print_r( $item[0]["streetAddress"] ); ?>

    Looking forward to help you.

    <?php $item = get_post_meta($post->ID, 'rank_math_snippet_jobposting_address', false); ?>
          <?php print_r( $item[0]['streetAddress'] ); ?>
    • This is works perfectly but I don’t know why it’s not working when use print_r command in single tag?
    • i use multiple lines to print streatAddress and pinCode, how to print in single array? like print_r( $item[0][‘streetAddress’][‘postalCode’] );

    Q. 1How to display expiry date? When call ‘rank_math_snippet_jobposting_expirydate’ it’s display 1596844800 for 2020-08-08 12:00 AM
    Q. 2Is it possible to display automatically post publish date at jobposting’s Date Posted section?
    Thank You

    • This reply was modified 2 days, 21 hours ago by Puneet.


    About question 1, databases usually store dates as seconds from 1970, you should convert it to current date, you can read about it here:

    About question 2, I am not sure to understand your question, could you give us more details?

    Looking forward to help you.


    You can customize the following filter:

    add_filter( "rank_math/snippet/rich_snippet_jobposting_entity", function( $entity ) {
     $entity['datePosted'] = get_the_date( $format,$post_id );//replace with date format and postid
     return $entity;
    }, 99 );

    Hope that helps. If you have any further question(s), please let us know. Thank you.

    Yes, it works perfectly.
    Now can we automatically print the last date also because most posts are valid for 30 days?
    So I want to print the last date [with 30 days validity from post publish date] automatically.
    For Example – New post is published on 2020-08-02T12:00 so after using the above code rank math default print Date Posted – 2020-08-02T12:00, but the Valid date must be 2020-09-02T12:00.

    Hi, I have now just checked my posts, this code is print today’s date on the whole website’s job posting section.

    // Rank Math Job posting Date
    add_filter( "rank_math/snippet/rich_snippet_jobposting_entity", function( $entity ) {
     $entity['datePosted'] = get_the_date( date("Y-m-d H:i:s"),$pot_id );
     return $entity;
    }, 99 );


    You will need to assign the post id value of the post to get date published then assign it to the $post_id variable.

    For the validity you can use $entity['validThrough']= //get post date plus 30 days.

    Hope that helps

Viewing 15 replies - 1 through 15 (of 16 total)

You must be logged in to reply to this ticket.