Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Adding relations to LinkIt #69

Open
siebird opened this issue Apr 20, 2017 · 0 comments
Open

FR: Adding relations to LinkIt #69

siebird opened this issue Apr 20, 2017 · 0 comments

Comments

@siebird
Copy link

siebird commented Apr 20, 2017

Super handy plugin–using LinkIt with a structure section to build all my site navs.

I just ran into an issue where I was trying to do relatedTo() search based off the current page a user was on to show a sub-navigation and realized LinkIt does not create relationships. I ended up having to do this below to get a sub-navigation working properly:

{## set section sub-navigation #}
{% set parentPage = craft.entries.slug(craft.request.firstSegment).first %}
{% set relatedNav = craft.entries.section('navMain').search('title:' ~ parentPage.title).order('score').first %}
{% set navSub = craft.entries.descendantOf(relatedNav).descendantDist(1) %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants