Skip Navigation

[Resolved] creating 2 post-relationship filters with select2

This thread is resolved. Here is a description of the problem and solution.

This support ticket is created 3 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 3 voices.

Last updated by emilyB-2 3 years ago.

Assisted by: Luo Yang.

Author
Posts
#1968191

Tell us what you are trying to do?
I had 2 post-relationship filters running, and once i implemented a select2 style filter on one of them, the PHP code i put in to run 2 post-relationship filters stopped working. and now i tried to revert back to normal select filters but I still can't run 2 post-relationship filters.
Is there any documentation that you are following?
I used this as the framework to create my PHP code:
https://toolset.com/forums/topic/search-filter-with-two-post-relation-ships/

#1968865

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

Toolset Views do not offer two relationships filters for the moment, it can be implemented using custom code, but that's out of the scope of the support forum.

I am willing to take a look at this archive template and try to find out what's not working as expected, but I can't give any promises that we can fix it. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
Please provide a test scenario to follow, something like:
1. I go to xxx
2. I do xxx
3. I expect to have xxx
4. Instead, I get xxx

#1973177

Hello,

Thanks for the details, I can login into your website.

Please point out the problem page URL and view URL, where I can test the result in front-end, thanks

#1973511

front end page url: hidden link
back end view url: hidden link

if you don't select any options in the drop down, the content will load. once you select an item and press submit, the content in the view loop no longer loads.

#1974213

I have change the PHP codes of your theme file functions.php line 96~109 to:

function filter_by_parent_services_func( $query_args, $view_settings, $view_id ) {
   if ( $view_id ==4860  && isset($_GET['wpv-relationship-filter'][0]) && $_GET['wpv-relationship-filter'][0] != 0) {
        if(!isset($query_args['toolset_relationships'])){
            $query_args['toolset_relationships'] = array(
        	array(
                'role' => 'parent',
                'related_to' => $_GET['wpv-relationship-filter'][0],
                'relationship' => 'psychologist-therapy-format'
		)
      );
	}
	}
    return $query_args;
}

Please test again, check if it is fixed, thanks

#1974255

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.