We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14788
    • 8 Posts
    This is pretty sad design. The user should be able to specify to use whatever document fields they want for the crumbs. By defining specific fields in the code below you limit the user’s options.

    Notice how alias isn’t included? What if I wanted to use the alias for crumbs instead of these given values? Well you can’t. Dumb.

        // Get next crumb
        $tempCrumb = $modx->getPageInfo($parent,0,"id,parent,pagetitle,longtitle,menutitle,description,published,hidemenu");
    
        // Check for include conditions & add to crumbs
        if (
            $tempCrumb['published'] &&
            ( !$tempCrumb['hidemenu'] || !$respectHidemenu ) &&
            !in_array($tempCrumb['id'],$ignoreIds)
        )
        {
            // Add crumb
            $crumbs[] = array(
            'id' => $tempCrumb['id'],
            'parent' => $tempCrumb['parent'],
            'pagetitle' => $tempCrumb['pagetitle'],
            'longtitle' => $tempCrumb['longtitle'],
            'menutitle' => $tempCrumb['menutitle'],
            'description' => $tempCrumb['description']);
        }
    


    To fix this bad code do the following.



        // Get next crumb
        $tempCrumb = $modx->getPageInfo($parent,0,"*");
    
        // Check for include conditions & add to crumbs
        if (
            $tempCrumb['published'] &&
            ( !$tempCrumb['hidemenu'] || !$respectHidemenu ) &&
            !in_array($tempCrumb['id'],$ignoreIds)
        )
        {
            // Add crumb
            $crumbs[] = $tempCrumb;
        }
    


    Also the wiki is outdated. No I’m not fixing it.
    http://wiki.modxcms.com/index.php/Breadcrumbs
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Or just use Wayfinder to generate your breadcrumb trail.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org