Skip to content
  1. Extras
  2. pdoTools
  3. Snippets
  4. pdoMenu


Menu generator snippet. It can replace Wayfinder, and allows more flexibility to specify properties.

For example, it can build menus from several parents, showing them both together and as separate branches.

Provides a substantial increase in speed, although only on first page view if the Wayfinder menu is cached.

If you never used Wayfinder before, it is a good idea to read the Wayfinder documentation, because pdoMenu reuses many of the Wayfinder concepts and settings. You can find the docs here, or download the excellent (but 184 page) Wayfinder ebook from this thread.


&parentsCurrent resourceComma-separated list of parents to search for results. If set to 0 will use all top-level resources. If the parent ID starts with a hyphen, it and its children are excluded from the result.
&level0 (no limit)The level(depth) of the generated menu.
&resourcesComma-separated list of resources to add into the results. If the ID of the resource starts with a dash, this resource is excluded from the results.
&templatesComma-separated list of templates to filter results. If the template ID starts with a dash, resources using it are excluded from the results.
&whereAn array of additional parameters encoded as JSON.
&displayStart0Include display of parent node. It is useful when you specify more than one «parents».
&contextSpecifying the Context of the resources to build the menu from.
&showHidden0Show resources that are marked to be hidden in the menu.
&showUnpublished0Show unpublished resources to everyone.
&previewUnpublished0Show unpublished resources only for logged-in Manager users with permission to view unpublished.
&hideSubMenus0Hide inactive submenu branches.
&selectComma-separated list of fields to retrieve. You can specify a JSON string array, for example {"modResource":"id,pagetitle,content"}. By default, all fields of the modResource object are selected. You don't need this option if you want to use fields like [[+introtext]] because they are already available. This option should be used if you do not want to retrieve all fields, but only those which you specify.
&sortbymenuindexAny resource field for sorting, including TV option the property &includeTVs is set. A JSON string can be specified with an array of several fields, for example {"tvname":"ASC", "pagetitle":"DESC"}. To randomly select sorting use «RAND()».
&sortdirASCSort Direction: Ascending or Descending. If parameters &sortby and &sortdir will be empty the sorting will be in the order of resources in &resources parameter.
&limit0Limit the number of results. Can be set to «0» for no limit.
&offset0Results skip from the beginning. It should be used with &limit
&checkPermissionsSpecify which user permissions to check when listing resources. If no permissions are specified, permissions will not be checked at all. For example, &checkPermissions=list
&countChildren0Count of the number of children of each parent resource and output it to the placeholder [[+children]]. It makes additional queries to the database, so is 0 by default.
&setTotal0Enable calculating all rows, which will also result in the "totalVar" placeholder being set.
&toPlaceholderIf not empty, the snippet will save its output to a placeholder with the same name, instead of returning the generated menu.
&plPrefixwf.Prefix for placeholders used in the template chunks
&showLog0Show debugging details on the processing of the snippet. Only displayed to logged-in Manager users.
&fastMode0Quick mode for processing chunks. All raw tags (output modifiers, snippets, etc.) are removed.
&cache0Caching snippet results.
&cacheTime3600Duration of the cache in seconds.
&scheme-1 (relative to site_url)How the URL is generated, based on values valid for the modX::makeUrl() API.
&useWeblinkUrl1When set to 1, the URL specified in a weblink resource will be output to the placeholder [[+link]] instead of the link to the weblink resource itself.
&rowIdPrefixIf set, this parameter creates a unique ID for each item. The value will be rowIdPrefix + docId.
&hereIdDefine the current ID to use for the snippet. Use a value of [[*id]] if the template specified by &tplHere and &tplParentRowActive is not applied correctly to the menu item.
&includeTVsDefine comma delimited list of TVs to include. For example, «action,time» will filled placeholders [[+action]] & [[+time]]
&prepareTVs1, prepares all TVs specified in &includeTVsComma-separated list of media source-dependant TV values to be prepared before output.
&processTVsComma-separated list of TVs that should be processed according to their output options. If set to «1», all TV listed in &includeTVs will be processed.
&tvPrefixPrefix TV property.

Template Properties

These properties specify the chunks that contain the templates to format the parts of the generated menus.

As stated above, if you never used Wayfinder before, at least skim through the Wayfinder docs before using your own chunks, even though pdoMenu uses a slightly different chunk hierarchy.

Even if you don't read the docs, make sure to include [[+wrapper]] in your chunks. Contrary to its name, it is a placeholder for wrapper content (it is similar to [[*content]] in your Resources). It will be replaced with your lower-level menu content. If you leave it out, parts of your menu or the whole menu will disappear without any error message.

&tplOuterChunk to wrap the entire menu block. default: @INLINE <ul[[+classes]]>[[+wrapper]]</ul>
&tplChunk for processing each resource. If not specified, the contents of the resource fields will be printed to the screen. Default: @INLINE <li[[+classes]]><a href="[[+link]]" [[+attributes]]>[[+menutitle]]</a>[[+wrapper]]</li>
&tplParentRowChunk for container item with children.
&tplParentRowHereChunk for current container item.
&tplHereChunk for the current resource
&tplInnerChunk wrapper for submenu sections. If empty will use &tplOuter
&tplInnerRowChunk for submenu rows.
&tplInnerHereChunk for submenu current item.
&tplParentRowActiveChunk for active category.
&tplCategoryFolderSpecial chunk for category resources. Category resources have isfolder = 1, and «(empty)» template or attribute «rel = category». Useful for creating top-level menu items that are not themselves active links.
&tplStartChunk for the parent resource, provided that &displayStart is also used. Default: @INLINE <h2[[+classes]]>[[+menutitle]]</h2>[[+wrapper]]

Properties for CSS classes

These properties specify the value of the placeholder [[+classes]] and [[+classnames]] for the various parts of the menu.

&firstClassClass for the first menu item. Default: first
&lastClassClass for the last menu item. Default: last
&hereClassClass for the active menu item and its parents. Default: active
&parentClassClass for parent items.
&rowClassClass for each menu row.
&outerClassClass for outer wrapper.
&innerClassClass for inner submenu wrappers.
&levelClassClass for each level of the menu. For example, if you specify «level», it will produce «level1», «level2» etc.
&selfClassClass for the current document in the menu.
&webLinkClassClass for the weblink resources.


A simple top-level menu:


2-level menu with the exception of certain parents:


Menu generated from two parents, showing the parents:


List all resources in one step:

  &tplInner=`@INLINE [[+wrapper]]`
  &tplParentRow=`@INLINE <li[[+classes]]><a href="[[+link]]" [[+attributes]]>[[+menutitle]]</a> ([[+children]])</li>[[+wrapper]]`