Can you explain a little more, I mean exact code what should be?
I have tried this code but not got the result as expected,
add_filter( "rank_math/snippet/rich_snippet_jobposting_entity", function( $entity ) {
date_modify($entity,"+29 days");
$entity['validThrough'] = get_the_date( date("Y-m-d H:i:s"),$pot_id );
return $entity;
}, 99 );
-
This reply was modified 4 years, 4 months ago by Puneet.
Hello,
Please check the following tutorial: https://www.w3schools.com/php/func_date_date_add.asp and these PHP manuals: https://www.php.net/manual/en/datetime.add.php on how to add dates.
Hope that helps.
Hey buddy I have done it! Final Code is
add_filter( "rank_math/snippet/rich_snippet_jobposting_entity", function( $entity ) {
$date = date_create(get_the_date('c'));
date_add($date, date_interval_create_from_date_string('29 days'));
$entity['validThrough'] = date_format($date, 'c');
return $entity;
}, 99 );
Hope this discussion benefits others too like me.
Thank You Rank Math team for your support.
Your product has still no competitor in the market. Keep It up!
Regards
Puneet Verma
Hello,
We are glad to hear everything is now working fine.
The details will be surely helpful.
Do you wish to close this thread now?
If you have any further question(s), please let us know. Thank you.
Hello Puneet,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.
Hi, I want to create a table on behalf of Job posting data. For example if Organization, Pay Salary exists in Job posting then print table otherwise none. So what should be the condition in if ($t < “20”).
I think it’s possible with If the condition like following?
<?php
$t = org("rank_math_snippet_jobposting_organization"); // If Organization is available, then it should be execute.
if ($t < "20") {
echo "Organization Name - [rank_math_snippet_jobposting_organization]";
}
?>
Hello,
Can you give us some more details? I am not sure what you mean by creating a table and how 20 is related to the JobPosting Organization option.
Looking forward to helping you.
I want to echo a table but there is a condition for echo i.e.
If Organization Name/ Salary is available then print table.
Hello,
Rank Math stores Organization & Salary value in following fields in postmeta table:
rank_math_snippet_jobposting_organization
, rank_math_snippet_jobposting_salary
.
So to show any data based on this content you can use following code:
$organization = get_post_meta( $post_id, 'rank_math_snippet_jobposting_organization', true );
$salary = get_post_meta( $post_id, 'rank_math_snippet_jobposting_salary', true );
if( $organization && $salary ) {
// Show custom content.
}
Please change $post_id with the Post ID on your site.
I hope that helps.
I want to apply this code {https://support.rankmath.com/ticket/job-posting-meta-display-in-php/page/2/#post-75060} only for jobs that published on pages, but not for single posts jobposting. So how to use condition for page in function.php?
Hi Puneet,
As much as we would love to offer customized solution to each and every user we have, it just isn’t possible for a small company like ours with limited resources.
You can hire a coder for that and they will help you customize the Schema further.
If you need help with anything else, please open a new support ticket here so we can help.
We are always here for assistance.