Forum Replies Created
-
AuthorPosts
-
rsmithgs25
ParticipantI was successful in being able to get the correct No Results message now that I’ve switched over to the Posts block.
Using the Elementor Custom Query Filter documentation as a guide, below is what I’ve tested. I’ve been able to return a specific post on the initial query (when the page initially loads), but I’m wanting to return the specific post if they type in the search a term that returns no results.
/*Attempt return specific post if no posts found in query*/ add_action('elementor/query/fellow-donations', function($query){ if(!$query->have_posts()){ $query->set('post__in', array(810)); //ends up returning the 1 post even if there are posts. //only returns this for the initial page load, after someone attempts to search and then backspaces everything shows } });I’m wondering if it may not be working due to another issue as well. When the page initially loads (without this script) my post 810, which is named “Unlisted Professor” is there, but if someone searches and then back spaces to have nothing in the search bar again when all of the elements load back in the “Unlisted Professor” post is no longer listed. I am not excluding it within the Advanced Options.
Thanks again for your help!
rsmithgs25
ParticipantYou cannot access this content.
rsmithgs25
ParticipantThank you Ernest! I think you got me on the right track. I’ll look more into that documentation for the Posts block. I just assumed because I was on an Archive page I needed to use the Archive Posts block.
I’ll let you know if I can get it to work or if I have any further questions regarding your plugin.
-
AuthorPosts