Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Conditional for the 2nd level child pages
#1
Greetings,

What I have

- Parent
--- Child
----- Child

I need to display the content for the 2nd level. For the 1st level child I use the following conditional:

Code:
<?php if (get_parent(false)=='parent'){ ?> Content <? }?>

What I should change / add to make the code work for the lower level child pages?

Actually it supposed to be the same conditional but it have to ignore / pass the parent page to reach the main parent page. Please help, my brain is about to blow.
Reply
#2
im very bad with php, but can this solve your problem?

<?php get_page_content("name of your page"); ?>

good luck
Reply
#3
[/root.] Wrote:Greetings,

What I have

- Parent
--- Child
----- Child

I need to display the content for the 2nd level. For the 1st level child I use the following conditional:

Code:
<?php if (get_parent(false)=='parent'){ ?> Content <? }?>

What I should change / add to make the code work for the lower level child pages?

Actually it supposed to be the same conditional but it have to ignore / pass the parent page to reach the main parent page. Please help, my brain is about to blow.

Using the I18n plugin, you can get the top-parent with
Code:
<?php
  $bc = return_i18n_breadcrumbs(return_page_slug());
  if ($bc[0]['url'] == 'my-parent') {
?>
    Content
<?php
  }
?>
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 1 Guest(s)