martijnH
Support threads created in the last 30 days: 0
Favorite Forum Topics
This user has no favorite topics.
Forum Topics Created
Status | Topic | Supporter | Voices | Posts | Freshness |
---|---|---|---|---|---|
Use comma in numberfield in wp-admin
Started by: martijnH in: Toolset Professional Support |
2 | 3 | 2 years, 4 months ago | ||
W3C error on distance filter
Started by: martijnH in: Toolset Professional Support |
2 | 5 | 2 years, 6 months ago | ||
Follow-up accessibility problem with distance filter
Started by: martijnH in: Toolset Professional Support |
2 | 3 | 2 years, 6 months ago | ||
Accessibility problem with distance filter
Started by: martijnH in: Toolset Professional Support |
2 | 3 | 2 years, 7 months ago | ||
Multiple close buttons in Toolset Blocks slider Lightbox
Started by: martijnH in: Toolset Professional Support |
2 | 2 | 2 years, 11 months ago | ||
other ticket is closed
Started by: martijnH in: Toolset Professional Support |
2 | 9 | 3 years, 1 month ago | ||
Random and invalid and tags.
Started by: martijnH in: Toolset Professional Support |
2 | 6 | 3 years, 2 months ago | ||
Orders publicly visible
Started by: martijnH in: Toolset Professional Support |
2 | 3 | 3 years, 5 months ago | ||
Image field in repeating fields group not saving
Started by: martijnH
in: Toolset Professional Support
Problem: Solution: |
2 | 3 | 4 years, 6 months ago | ||
Conflict official Font Awesome plugin (4.0.0-rc20) and Toolset
Started by: martijnH in: Toolset Professional Support |
3 | 6 | 4 years, 7 months ago | ||
Custom search view showing expected results
Started by: martijnH in: Toolset Professional Support |
2 | 3 | 4 years, 12 months ago | ||
Error on saving a view "Synchronous XMLHttpRequest on the main thread…"
Started by: martijnH in: Toolset Professional Support |
1 | 2 | 5 years, 2 months ago | ||
Theme options not shown in content template
Started by: martijnH in: Toolset Professional Support |
2 | 6 | 5 years, 9 months ago | ||
View with child post type: hide posts where parent is private/concept (part 3)
Started by: martijnH
in: Toolset Professional Support
Problem: I have a post relationship between two post types. I want to show a View of child posts where the parent post is not private. Solution: Use custom code to test each child post's parent. Private parent posts will not be returned for any guest Users. Also test the post status, so logged-in Users will not see child posts of their own private parent posts. add_filter('wpv_filter_query', 'ts_parent_not_private_func', 10, 3); function ts_parent_not_private_func($query, $view_settings, $view_id) { $views = array( 16813, 16403 ); // only filter these views if( in_array( $view_id, $views ) ) { $child_ids = array(); // we will push IDs here if the parent is not found, or private $children_args = array( 'post_type' => 'training-datum', 'posts_per_page' => '-1', 'post_status' => 'publish', // you may want to add more filters here to improve the performance of this query ); $children = new WP_Query($children_args); foreach( $children->posts as $child ){ $parent = toolset_get_related_post( $child, 'training_training-datum', 'parent' ); // if there is no parent or the parent is private, push this ID into the exclusion array if( !$parent || get_post_status($parent) == 'private' ){ array_push( $child_ids, $child->ID ); } } $query['post__not_in'] = isset( $query['post__not_in'] ) ? $query['post__not_in'] : array(); $query['post__not_in'] = array_merge($query['post__not_in'], $child_ids ); } return $query; } Relevant Documentation: |
2 | 7 | 6 years, 2 months ago | ||
View with child post type: hide posts where parent is private/concept
Started by: martijnH
in: Toolset Professional Support
Problem: I have a View of child posts. I would like to apply a query filter so that the View only shows children of parents that are NOT marked "private". Solution: add_filter('wpv_filter_query', 'ts_parent_not_private_func', 10, 3); function ts_parent_not_private_func($query, $view_settings, $view_id) { $views = array( 16813, 16403 ); // only filter these views if( in_array( $view_id, $views ) ) { $child_ids = array(); // we will push IDs here if the parent is not found, or private $children_args = array( 'post_type' => 'training-datum', 'posts_per_page' => '-1', 'post_status' => 'publish', // you may want to add more filters here to improve the performance of this query ); $children = new WP_Query($children_args); foreach( $children->posts as $child ){ $parent = toolset_get_related_post( $child, 'training_training-datum', 'parent' ); // if there is no parent or the parent is private, push this ID into the exclusion array if( !$parent || get_post_status($parent) == 'private' ){ array_push( $child_ids, $child->ID ); } } $query['post__not_in'] = isset( $query['post__not_in'] ) ? $query['post__not_in'] : array(); $query['post__not_in'] = array_merge($query['post__not_in'], $child_ids ); } return $query; } Relevant Documentation: |
2 | 6 | 6 years, 2 months ago |