Hello,
There isn't such kind of built-in feature within Toolset, you might consider custom codes, for example:
1) Create a custom shortcode with custom PHP function:
https://developer.wordpress.org/reference/functions/add_shortcode/
2) In this PHP function, get the post ID using post slug:
https://stackoverflow.com/questions/14979837/wordpress-query-single-post-by-slug
3) Then use above post ID to get the custom field value:
https://developer.wordpress.org/reference/functions/get_post_meta/
See above document, the WP function get_post_meta() is using post ID to retrieve custom fields.
I was thinking that for the long story of Toolset this is not the first time when such question appears. I am not a programmer. So maybe it is possible to receive the code from support team?
According to our support policy, we don't provide the custom codes support:
https://toolset.com/toolset-support-policy/
If you need more assistance for it, please provide a test site with the same problem also point out the problem post URL, I can setup a demo for you. Private message box enabled.
Yes. I still need help. I create several tickets and receive 100% ZERO help. You dont need any my website. I did describe my problem. You and you friend in enother topic just allways tell me there is no problem or give me access. And no help back. I dont feel that i should wast my time creating some useless websites just because you pretend not to understand. There are huge amount of other topics where users resive snippets of code for help to users.
Your help is useless. I still have time to recive my money back if you cant help me.
Please check our support policy as I mentioned above:
https://toolset.com/toolset-support-policy/
We cannot produce custom code solutions for you.
Since you are asking for some not-built-in feature, so it requires custom codes, and for different website, and different settings, the custom codes is different, and I have provide detail steps and documents in my first answer:
https://toolset.com/forums/topic/access-to-types-using-slug/#post-1815993
Here is an example:
1) Add below custom codes into your theme file "functions.php"
add_shortcode('get_field_by_postslug', function($atts, $content){
$atts = shortcode_atts( array(
'name' => '',
'field' => '', // title, alt or id return
), $atts);
$args = array(
'name' => $atts['name'],
'post_type' => 'post', // here replace with your custom post type slug
'post_status' => 'publish',
'numberposts' => 1,
'fields' => 'ids'
);
$posts = get_posts($args);
$res = '';
if(isset($posts[0]) && is_numeric($posts[0])){
$res = get_post_meta($posts[0], 'wpcf-' . $atts['field'], true);
}
return $res;
});
You will need to customize above codes according to your website settings.
2) Use above shortcode like this:
[get_field_by_postslug name="my-post-slug" field="my-field-slug"]
For your reference.