igorL-3
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 |
|---|---|---|---|---|---|
|
Filtering Posts for relationship connection in a submission form
Started by: igorL-3
in: Toolset Professional Support
Problem: I would like to filter the parent post options in a Form that creates child posts. I would like to add custom code that filters the options based on their other post relationships. Solution: Use the pre_get_posts filter to filter the parent post options in the parent post field. See the following example code:
/**
* Filter the Children parent field in the connect-toy-to-childmale Relationship Form
* to only show Children connected to Gender Male.
* https://toolset.com/forums/topic/filtering-posts-for-relationship-connection-in-a-submission-form/
*/
function filter_parent_posts( $query ){
$parent_post_type = "child"; // slug of parent post type
$child_post_type = "toy"; // slug of child post type
$rel_slug = "gender-child"; // slug of gender-child post relationship
$male_post_id = 9; // ID of Gender Male post
$rel_form_id = 26; // ID of the relationship form
// relationship form is on Toy single posts, queries parent_post_type posts
if ( ( defined('DOING_AJAX') && DOING_AJAX )
&& isset($query->query['post_type'][0])
&& $query->query['post_type'][0] == $parent_post_type
&& isset($_REQUEST['action'])
&& $_REQUEST['action'] == 'cred_association_form_ajax_role_find'
&& isset($_REQUEST['form_id'])
&& $_REQUEST['form_id'] == $rel_form_id
) {
// querying by gender post, which is parent in gender-child
$males = toolset_get_related_posts( $male_post_id, $rel_slug, array(
'query_by_role' => 'parent',
'limit' => 1000,
'offset' => 0,
'args' => array(),
'return' => 'post_id',
'role_to_return' => 'child'
));
$query->set( 'post__in', $males );
}
}
add_action( 'pre_get_posts', 'filter_parent_posts', 101, 1 );
Relevant Documentation: https://toolset.com/forums/topic/filter-post-relationship-dropdown-by-taxonomy/#post-1220408 |
|
2 | 12 | 4 years, 5 months ago | |
|
Get new and previous value before save data for many to many relationships
Started by: igorL-3 in: Toolset Professional Support |
|
2 | 3 | 4 years, 6 months ago | |
|
Confirmation of Delete Post
Started by: igorL-3 in: Toolset Professional Support |
|
2 | 9 | 4 years, 6 months ago | |
|
Editing Forms for old posts with many-to-many relationships
1
2
Started by: igorL-3
in: Toolset Professional Support
Problem: I would like to understand how to manage M2M relationships with Forms and Views. Solution: Use Views and Relationship Forms to manage relationships between M2M posts. See the sandbox site details in the ticket for more information. |
|
2 | 16 | 4 years, 6 months ago | |
|
Relationships not showing up in the list
Started by: igorL-3
in: Toolset Professional Support
Problem: I have a custom types PEOPLE and ART. I also have several many-to-many relationships. I have relationship ARTIST: between PEOPLE[*] <>ART[*] and relationship BUYER: PEOPLE[*] <>ART[*]. I now what to add a VIEW to the CONTENT TEMPLATE for individual ART post, the ARTIST associated with the post ART and also, as a separate VIEW the BUYER associated with each ART post. However, I’m not given that option . I’m given the option to select PEOPLE or ART but not the relationship I want to display. Solution: You just need to create two views, filter by different post type relationships, see our document: Relevant Documentation: https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items |
|
2 | 3 | 4 years, 6 months ago | |
|
Can different templates be applued applied to custom post depending on a condion
Started by: igorL-3 in: Toolset Professional Support |
|
2 | 7 | 4 years, 6 months ago | |
|
I want to assign a child post from a dropdown list programatically in JS
Started by: igorL-3 in: Toolset Professional Support |
|
2 | 12 | 4 years, 6 months ago | |
|
Associating more than one child on a submission form
Started by: igorL-3
in: Toolset Professional Support
Problem: Add custom JS/CSS codes into Toolset Relationship form. Solution: The client solved the problem by these: https://toolset.com/forums/topic/associating-more-than-one-child-on-a-submission-form/#post-2010369 Relevant Documentation: |
|
2 | 7 | 4 years, 6 months ago | |
|
Display Child Fields
1
2
Started by: igorL-3 in: Toolset Professional Support |
|
2 | 19 | 4 years, 7 months ago | |
|
Unable to create archive templates
Started by: igorL-3
in: Toolset Professional Support
Problem: Solution: |
|
2 | 8 | 4 years, 7 months ago | |
|
Critical error when creating content template on some Post Types.
Started by: igorL-3 in: Toolset Professional Support |
|
3 | 10 | 4 years, 7 months ago | |
|
Unable to reply to ticket!!!
Started by: igorL-3 in: Toolset Professional Support |
1 | 2 | 4 years, 7 months ago |