Ich habs geschafft :)
PHP
<?php //parent variables $parent = get_post($post->post_parent); $parent_title = get_the_title($parent); $grandparent = $parent->post_parent; $grandparent_title = get_the_title($grandparent);?> <?php // is the homepage the granparent? if ($grandparent == is_page('0')) { ?> <li><a href="/<?php echo get_permalink($grandparent); ?>">12 <?php echo $grandparent_title; ?></a></li> <?php // is the homepage the parent? } elseif ($post->post_parent == is_page('0')) {?> <li> <a href="<?php echo get_permalink($post->post_parent) ?>">1234 <?php echo $parent_title; ?></a></li> <?php // I must be a top level page! } else { ?> <li> <a href="<?php echo get_permalink($post->post_parent) ?>">123554 <?php echo $parent_title; ?></a></li> <?php }?> <br /> <?php if ( is_page() ) { if($post->post_parent) $children = wp_list_pages('sort_column=menu_order&title_li=&child_of='.$post->post_parent.'&echo=0'); else $children = wp_list_pages('sort_column=menu_order&title_li=&child_of='.$post->ID.'&echo=0'); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } // End If Post } // End if is page ?>
Könnte sich bitte jemand den code ansehen ob man ihn eventuell optimieren bzw. kürzen könnte?
Wie mache ich das die oberste Ebene nicht current_page_item verliert?
Grüße