Hi Menno,
Thank you for contacting us and I'd be happy to assist.
A few points related to your question:
1. The simple custom fields like a single line type can be used directly in snippet variables, in this format:
%%cf_<custom-field-name>%%
For example, if you have a Toolset custom field with the slug "job-availability", it can be used like this:
%%cf_wpcf-job-availability%%
Note: By default, Toolset custom fields are saved with a "wpcf-" prefix appended to their slugs.
2. However, for other complex type custom fields like radio buttons, checkboxes, etc, you'll need to register a custom template variable using the "wpseo_register_extra_replacements" hook, as you're using in your code snippet:
hidden link
hidden link
3. The code snippet that you've shared seems fine and the only thing missing is that it is using "$post_id" to pass on the current post's ID, but that is not defined in the function.
To make it use the current post's ID, you can replace the line:
$job_availability = get_post_meta($post_id, 'wpcf-job-availability', true);
With:
$job_availability = get_post_meta(do_shortcode('[wpv-post-id]'), 'wpcf-job-availability', true);
Note: To get the Toolset custom field values in your custom code, you can alternatively use "Types Fields API", instead of "get_post_meta" function:
https://toolset.com/documentation/customizing-sites-using-php/functions/
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar