Adakah tag conditional khusus untuk page (parent) sekaligus child atau partnya? #278
Answered
by
taufik-nurrohman
bungfrangki
asked this question in
Q&A
-
Misalnya saya punya page dan sub-page seperti ini:
Dan pada html saya ingin menampilkan informasi yg sama pada parent-page (superheroes) dan childnya, misalnya seperti ini:
apakah ada tag kondisi seperti itu? sehingga saya tidak perlu menuliskan informasi repetitif pada halaman2 tersebut. |
Beta Was this translation helpful? Give feedback.
Answered by
taufik-nurrohman
Dec 7, 2023
Replies: 2 comments 2 replies
-
Mungkin begini: <?php if ('superheroes' === $page->name || ($page->parent && 'superheroes' === $page->parent->name)): ?>
<!-- Info superhero di sini... -->
<?php endif; ?> Atau begini: <?php if (str_starts_with($url->path . '/', '/superheroes/')): ?>
<!-- Info superhero di sini... -->
<?php endif; ?> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
taufik-nurrohman
-
terima kasih mas, berhasil diterapkan. maaf mas, tambah 1 pertanyaan lagi yaa. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mungkin begini:
Atau begini: