Problem:
The user has a select field with dynamic option values. The options of the field are generated using Toolset Types filter wpt_field_options. The generated options are the months of the last two years.
Inside a view, the field is not displayed anymore.
Solution:
It turns out that the values that are not displayed are not included in the values generated by the wpt_field_options filter. Toolset returns an empty value.
The solution is to use a custom shortcode that will return the row value from the database.
// The shortcode needs to be added in Toolset->Settings->Custom Code.
add_shortcode('meta', 'meta_fun');
function meta_fun($atts){
global $post;
$atts = shortcode_atts(array(
'field' => NULL,
), $atts);
extract($atts);
if( NULL === $field ) return;
// return "Voila";
return get_post_meta($post->ID, $field, true);
}
// How to use it inside the view
[meta field="wpcf-production-year-month"]
Problem: I have two post types - Hosts and Structures - in a post relationship. Each User can be the author of one Host post, and can create multiple Structure posts using Forms. When the User submits a Form to create one of these Structure posts, I would like to automatically connect it to the User's Host post.
Solution: Use the cred_save_data API to trigger custom code when the Structure post is created. Use the toolset_connect_posts API to link the two posts programmatically.
Problem: I would like to display some text if a post has any taxonomy terms assigned.
Solution: Use a Toolset Conditional block to test whether or not the custom taxonomy is an empty value. Place the Fields and Text block inside the Conditional block.