esmondR
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 |
---|---|---|---|---|---|
how to display a view of posts related to post by shared custom field value via
Started by: esmondR
in: Toolset Professional Support
Problem: The issue here is that the user wanted to filter their current view by the custom field on the current page. Solution: In this case the user was using the Classic Editor for Blocks to create their view so they are able to use this method below. What you need to do is to add a query filter to your view and then set the query filter to get the value from a shortcode attribute. Then you will be able to filter the view by passing the shortcode directly into the view like this. [wpv-view name='my-view' param="[types field='my-field'][/types]"] Where my-view is the slug of your view "param" is the shortcode parameter you've set in the filter and "my-field" is the slug of the field. If you are using the Block view then this can be done by using the Hook below. add_filter( 'wpv_filter_query', 'filter_by_post_customfield',99,3 ); function filter_by_post_customfield( $query_args,$view_settings,$view_id ) { if ( $view_id == 4187) { $post_id = get_the_ID(); $meta_val = get_post_meta($post_id, 'wpcf-parent-model-name-custom-field' ); $query_args['meta_query']= array( array( 'key' => 'wpcf-parent-model-name-custom-field', 'value' => $meta_val[0], 'compare' => '=', ), ); } return $query_args; } To use the Hook add it to your Toolset Custom code section in Toolset -> Settings -> Custom Code and add it. Ensure that it has been activated. Now what you need to do is to change the 4187 to the ID of your view and change "wpcf-parent-model-name-custom-field" to the slug of the custom field that you want to get the value for on the current page keeping the wpcf- prefix. Next replace the second instance of wpcf-parent-model-name-custom-field to the field slug that you want to check for on the post type that the view is listing. In this user's case both fields were on the post being queried. |
2 | 9 | 3 years, 8 months ago | ||
Limit number of choices to be selected in dropdown of categories on a post form
Started by: esmondR in: Toolset Professional Support |
2 | 2 | 5 years ago | ||
Save a post relationship parent title as a custom field entry in the child post
Started by: esmondR in: Toolset Professional Support |
2 | 4 | 5 years, 1 month ago | ||
Is there anyway to automatically set a post reference or relationship?
Started by: esmondR in: Toolset Professional Support |
2 | 3 | 5 years, 3 months ago | ||
Generate post title from multiple custom fields entries
Started by: esmondR in: Toolset Professional Support |
2 | 3 | 5 years, 3 months ago | ||
Is it possible to populate a cred select field from a url parameter?
Started by: esmondR
in: Toolset Professional Support
Problem: The issue here was that the user wanted to know if it was possible to populate a select field based on the url value. Solution: Unfortunately no this is not possible to do. |
2 | 3 | 5 years, 3 months ago | ||
Using GravityView to edit a gravity form entry from a Toolset View
1
2
Started by: esmondR
in: Toolset Professional Support
Problem: Solution: You can find the proposed solution in this case with the following reply: Relevant Documentation: |
3 | 19 | 5 years, 3 months ago |