Search the blog

It’s really easy to create a breadcrumb trail in ProcessWire as the API allows you to traverse the relationship between pages.

You can store the breadcrumb pages in an array like this:

$breadcrumbs = [];

$parents = wire('page')->parents();

foreach($parents as $parent) {

	// Get the URL and title; you can get any other page fields you like
    $breadcrumbs[] = [

        'url' => $parent->url,
        'title' => $parent->title



Now you have the data all you need to do is putput it. E.g:

<div class="breadcrumb">
    <?php foreach ($breadcrumbs as $crumb): ?>
    <a href="<?= $crumb['url'] ?>"><?= $crumb['title'] ?></a> »
    <?php endforeach ?>
    <?= wire('page')->title ?>
Tim Bennett is a freelance web designer from Leeds. He has a First Class Honours degree in Computing from Leeds Metropolitan University and currently runs his own one-man web design company, Texelate.