Skip to content

Kirby 4.5.0

$page->isActive()

Checks if the page is the current page

$page->isActive(): bool

Return type

bool

Parent class

Kirby\Cms\Page

Example

<nav role="navigation">
  <ul>
    <?php foreach($pages as $subpage): ?>
    <li<?php e($subpage->isActive(), ' class="active"') ?>>
      <a href="<?= $subpage->url() ?>">
        <?= html($subpage->title()) ?>
      </a>
    </li>
    <?php endforeach ?>
  </ul>
</nav>