Created
October 1, 2021 14:45
-
-
Save gjhead/fc65472c003bbb27c3adbf8fd6c37457 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can query for that parent page's entry model with a new ElementCriteriaModel. | |
{% set mainEntry = craft.entries.id(100).first() %} | |
{% if mainEntry %} | |
{% set matrixField = mainEntry.matrixFieldHandle %} | |
{% set firstContentBlock = matrixField.type('content').first() %} | |
{% if firstContentBlock %} | |
{{ firstContentBlock.myRichTextFieldHandle }} | |
{% endif %} | |
{% endif %} | |
Instead of using the entry's ID as the link to that entry, you can also use other parameters to query for the entry model. Here's an example using slug and section: | |
{% set mainEntry = craft.entries.section('news').slug('main-news').first() %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment