Skip to content

Cara Menampilkan Parent Title dari Sebuah Parent Gimana ya Kang? #225

Discussion options

You must be logged in to vote

Manual mas:

$folder = dirname($page->path);
if (
    is_file($parent = $folder . '.archive') ||
    is_file($parent = $folder . '.page')
) {
    $parent = new Page($parent);
} else {
    $parent = new Page;
}

echo $parent->title ?? i('Untitled');

Di versi 3.x.x nanti bakal ada metode parent() bawaan untuk mempermudah:

echo $page->parent->title ?? i('Untitled');

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@yuliakbard
Comment options

@taufik-nurrohman
Comment options

Answer selected by yuliakbard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants