bbeer Posted August 28, 2014 Share Posted August 28, 2014 Hi the search outputs pages that are set to hidden in settings. the search term is $matches = $pages->find("title|body|summary%=$q, limit=50"); How can I exclude hidden pages from search listings Can I add other criteria to exclude pages? thanks for your help Link to comment Share on other sites More sharing options...
kongondo Posted August 28, 2014 Share Posted August 28, 2014 Strange....could this be your problem? https://processwire.com/talk/topic/1610-navigation-outputting-even-hidden-pages/ TL:DR = updating a wrong site hence not seeing changes? i.e. have both local and live site admins open Link to comment Share on other sites More sharing options...
onjegolders Posted August 28, 2014 Share Posted August 28, 2014 Would they display as you are logged in as superuser? Link to comment Share on other sites More sharing options...
bbeer Posted August 28, 2014 Author Share Posted August 28, 2014 they display always, as if they where not set to hide form searches and navigation. Link to comment Share on other sites More sharing options...
SiNNuT Posted August 28, 2014 Share Posted August 28, 2014 Would they display as you are logged in as superuser? I don't think that it would make a difference? $pages->find will exclude hidden by default, regardless of permissions and roles Link to comment Share on other sites More sharing options...
bbeer Posted August 28, 2014 Author Share Posted August 28, 2014 Ok getting closer. those pages where children of a hidden document, but where set to visible. Is there a way to prevent such pages. Another problem is, that unpublished pages are showing up in the search results as well. Can this be prevented? Link to comment Share on other sites More sharing options...
SiNNuT Posted August 28, 2014 Share Posted August 28, 2014 Ok getting closer. those pages where children of a hidden document, but where set to visible. Is there a way to prevent such pages. Another problem is, that unpublished pages are showing up in the search results as well. Can this be prevented? What do you mean by 'prevent'? You would want to enforce that children of a hidden page are also hidden? Unpublished pages should be excluded by default; i'm not sure but you've got a funky thing going on. Does explicitly adding status!=unpublished to your selector solve unpublished pages showing in the result? Link to comment Share on other sites More sharing options...
bbeer Posted August 28, 2014 Author Share Posted August 28, 2014 Solved! the unpublished Documents where listed when logged in only. Sorry for the confusion. Need to add some more facts for your understanding. In that site we use parent documents as folders for certain products (groups). We have several product groups. The client was sure, when he sets the parent Document to hidden, that all the child elements (products of that group) would be hidden as well. So it would really help, if it would be possible to hide all documents from search of a certain template, when the parent document is hidden, making it possible to hide whole product groups with one click. your advise is much appreciated! Link to comment Share on other sites More sharing options...
OLSA Posted August 14, 2015 Share Posted August 14, 2015 So it would really help, if it would be possible to hide all documents from search of a certain template, when the parent document is hidden, making it possible to hide whole product groups with one click. your advise is much appreciated! Hello, my question is the same: how to hide page tree, or only parent is hidden and want to hide from search results and all it's children? Tried with selector "parent != hidden", "has_parent != hidden" etc. but without success (not logged in). Also option with id works but I need flexible options (for adminstrations / clients). Thanks. Link to comment Share on other sites More sharing options...
LostKobrakai Posted August 14, 2015 Share Posted August 14, 2015 Try this, but it can only work for direct descendants, not for a whole tree. parent.status!=hidden To get the whole tree excluded you'd need a more advanced selector, which only works on db calls and not for runtime filtering: has_parent!=[status=hidden] This does first call all hidden pages and then exclude them with the has_parent selector 2 Link to comment Share on other sites More sharing options...
OLSA Posted August 14, 2015 Share Posted August 14, 2015 has_parent!=[status=hidden] Thank you LostKobrakai! That selector works. My idea was to create field where they can store/type parents id like : "2025|2230"... and later in search template "has_parent!={...}". Thanks and regards. Link to comment Share on other sites More sharing options...
Andy Posted March 18, 2019 Share Posted March 18, 2019 On 8/14/2015 at 8:56 AM, LostKobrakai said: Try this, but it can only work for direct descendants, not for a whole tree. parent.status!=hidden To get the whole tree excluded you'd need a more advanced selector, which only works on db calls and not for runtime filtering: has_parent!=[status=hidden] This does first call all hidden pages and then exclude them with the has_parent selector Try this. Closed admin pages has_parent!=2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now