cb2004 Posted July 5, 2017 Share Posted July 5, 2017 I am creating some calls to action and I am banging my head against the wall for something which I know is simple. Lets say my structure is: - Books (id = 1) -- Book Year --- Book - Videos (id = 2) -- Video Year -- Video So on my whole template in a side bar I want to link to Books and Videos so: $ctas = $pages->find("id=1|2, sort=sort"); Nice and simple. To stop the link to itself when I am on the page this is: $ctas = $pages->find("id=1|2, id!=$page, sort=sort"); But lets say I am in Book Year or Book, I don't want to display a link to the parent Books as I am already in a child and this is handled by breadcrumbs. I have tried so many selectors I think I have exhausted them all, so I must be missing something. Cheers. Link to comment Share on other sites More sharing options...
DaveP Posted July 5, 2017 Share Posted July 5, 2017 This should work $ctas = $pages->find("id=1|2, id!=$page->parents->append($page), sort=sort"); (Completely untested.) 4 Link to comment Share on other sites More sharing options...
cb2004 Posted July 5, 2017 Author Share Posted July 5, 2017 Awesome work DaveP, with some brackets around the $page->parents we got there: $ctas = $pages->find("id=1|2, id!={$page->parents->append($page)}, sort=sort; Virtual beer your way Sir. Link to comment Share on other sites More sharing options...
DaveP Posted July 5, 2017 Share Posted July 5, 2017 Completely forgot the curly brackets. Virtual 'Cheers!'. 1 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