Skip Navigation

[Resolved] No items found in slider and view

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

Problem:
No items found in slider and view

Solution:
You can use view's filter hook "wpv_filter_query" in order to change view's query on fly.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/no-items-found-in-slider-and-view/#post-1136691

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

This support ticket is created 6 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 11 replies, has 3 voices.

Last updated by NattapatP8602 6 years ago.

Assisted by: Minesh.

Author
Posts
#1135771

I'm using slider and view to create the Related listing (custom post type)
I want to display the listing by base on the same "Project" (parent post relationship)
And it says "No items found"

I did read all the thing I can find, still cannot solve it.
I think you have to see it through the access.

#1136033

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

well - could you please share problem URL where you added your view?

I have set the next reply to private which means only you and I have access to it.

#1136635
#1136691

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I've added the following filter to your current theme's functions.php file:

function func_display_related_post( $query_args ,$view_settings, $view_id ) {
	global $post;
	
	if ( $view_id == 151 ) {
		$parent_post_id = toolset_get_related_post( $post->ID,'project-listing','parent');
		$view_settings['post_relationship_id'] = $parent_post_id;
        
    }
    return $query_args;
}
add_filter( 'wpv_filter_query', 'func_display_related_post', 10, 3);

And I can see not its working fine.
=> hidden link

Additionally, to test this issue with elementor, I need your elementor pro version. Could you please share it so I will be able to test it and feel free to close the ticket.

#1136965

My Elementor Pro is Version 2.1.11

I don't get one thing.
Is it normal to put the manual code like that ?
Is it suppose to work with in toolset itself ?

#1137516

Hi,

Minesh isn't available, he has one day vacation, you will get the response ASAP when he back on Thursday.

#1137988

Hi, Luo Yang
Thank you for the informing

#1137998

My issue is resolved now. Thank you!
The code that Minesh input in function.php made elementor error message
And I cannot save the template because of that "Server Error".

Then,I decide to delete the code and somehow the view that I made still work with extra code.
Mann, It keep getting weirder I'm so confused.
So, the problem is solved I guess.

Thank you for your time guys

#1138020
Fix.JPG
Dynamic.JPG

Now I see why it work.
Minesh change my filter to specific" project name"

It should be dynamic.
The slide should show base on the Same project name of the current post.

Imagine if the listing Project name change, the slider should change too right ?
If you fix the project, how it going to be dynamic ?

#1138035

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - the code I've added is to make the things dynamic.

As you can see with the following reply - we are getting the parent relationship post ID using toolset_get_related_post which is based on current post ID.
=> https://toolset.com/forums/topic/no-items-found-in-slider-and-view/#post-1136691

Using filter 'wpv_filter_query' actually, we are overriding the argument to make it dynamic.

#1138045

Welcome back Minesh
I put your code back on. And it still now showing.
Should I set the filter back to a specific "Project" ?
And Why we need it?
I think I miss something that I don't understand.

#1138054

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As I said we added that filter that belongs to a specific project but we also added the 'wpv_filter_query' that will help to make the project assignment dynamically based on the post ID.

As you can see I used to fetch the the parent post ID:

 $parent_post_id = toolset_get_related_post( $post->ID,'project-listing','parent');
        $view_settings['post_relationship_id'] = $parent_post_id;

And this applies to filter the view results before view throws the results on the frontend. So I suggest you to keep the filter which I added and the code which I added to functions.php file.

#1138063

I will stick too that .

I thought the the filter option :
Select items "in the Project-Listing "
as related items of...
"The post where this View is shown"
is the way to get the post that is in the same parent.

So, it actually need the custom code.

Thank you for the clarify ,Minesh.