Problem: I would like to use a custom function in a conditional, but I cannot get it to work as expected.
Solution: In this case it is possible to create a custom shortcode instead of a function that adds a filter and returns some result. See the below format for creating a custom shortcode that returns some value, then register the shortcode name in Toolset > Settings > Frontend Content > 3rd-party shortcode arguments.
function paid_memebers_filter() {
$value = 'notpaid';
// ... your code should modify $value here if necessary...
return $value;
}
add_shortcode( 'paidviewfilter', 'paid_memebers_filter' );
Problem:
The user would like to exclude some fields from REST API calls
Solution:
This will need custom code, check this example:
// This is to enable the filtering at all.
add_filter( 'toolset_rest_run_exposure_filters', '__return_true' );
// exclude "book-additional-notes" custom field from "book" custom post type.
add_filter( 'toolset_rest_expose_field', function(
$expose_field, $domain, $group_slug, $field_slug, $element_type, $element_id
) {
if( 'posts' === $domain && 'book' == $element_type && 'book-additional-notes' == $field_slug ) {
return false;
}
// Different case - do not alter the result.
return $expose_field;
}, 10, 6 );
Problem:
The user is unable to create categories when Toolset Types is active.
Solution:
The default post type "Posts" has categories deactivated, check this screenshot http://prntscr.com/vhy82l
I had to switch my user language to English as I am not comfortable with a Spanish user interface.
As you can see in this screenshot http://prntscr.com/vhy90m Categories are only activated for the custom post type "Fichas de empresas" and it is also available on its sub-menu.