Types plugin provides a fields API, making it easy to display custom fields on your website’s front-end. The corresponding function call outputs the desired fields with a special formatting and supports different attributes for each field type.
Viewing 15 topics - 676 through 690 (of 995 total)
I created a function in my existing site where I was getting parent or grand parent post id using get_post_meta function, My question is that how can I perform same in toolset 3.0.
Solution:
In Types 3.0, You can continue to maintain relation in postmeta using _wpcf_belogs_parent_id, it will be able to work in new relational table as well, and in future version of Types 3.1, we will introduce new API function to setup new post type relationship.
Problem: I would like to use the new Post Relationships API toolset_get_related_posts with a meta key filter, but it doesn't seem to be working as expected.
Solution: Be sure to add the wpcf- prefix to the custom field slug, since this query interacts directly with WordPress APIs.
$progetti_collegati1 = toolset_get_related_posts(
get_the_ID(), //Post to query by.
'rel-corso-di-studio-progetto', //Slug of the relationship to query by
'parent', //Name of the element role to query by.
10, //Maximum number of returned results
0, //Result offset
array( //Additional query arguments
'meta_key' => 'wpcf-contenuto-in-evidenza',
'meta_compare' => 'LIKE',
'meta_value' => '0'
),
'post_id', //Determines return type
'child', // which posts from the relationship should be returned
'title', //orderby: null, 'title', 'meta_value', 'meta_value_num'
'ASC' // $order 'ASC' or 'DESC'.
);