Answer the question
In order to leave comments, you need to log in
How to write conditions for child pages?
Hello!
I want to prescribe a couple of conditions that will be displayed on the child pages of the parent.
Well, let's say, the button back to the parent, highlighting the link in the main menu, etc. on the little things
This is how the child looks like test1489.nineight.ru/?page_id=504
Here is
the parent not connected in any way.
I want to prescribe the conditions not for a specific child, but for all children in the print.
What do I need to look for in the wp structure in order to make changes in the code there?
Answer the question
In order to leave comments, you need to log in
$post_ID - variable outside the loop does not exist! Although the condition works out, nevertheless causing an error along the way, for Vasya Pupkin's business card sites it's one * delightful ... b> And so it will do.
If you still do it wisely and the layout requires you to write it outside the loop, then like this:
<?php if (wp_get_post_parent_id( get_the_ID() ) == 24) { // если это вложенная страница к странице НОВОСТИ с ID=24 ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question