Element Variable for Craft CMS Access any element from templates.

Developed by Yuri Salimovskiy


Accepts 2 parameters: first is element type (e.g. 'MatrixBlock', 'Asset', 'Entry', 'Commerce_Variant') second is array of criterias to fetch the element (anything supported by ElementCriteriaModel)

Example usage: {{ craft.element.get('MatrixBlock', {'type': 'video'}).first().url }}

Commercial plugins

  • Scraper

    Fetch HTML content from any URL, select DOM elements using CSS selectors, and manipulate/output content via Twig.
    Top Shelf Craft (Michael Rog), November 20, 2014


Plugin Development 101

Don't miss any Craft tips, tricks, and community updates