If children, parent title, if not, No title!
-
So…
New to php and wordpress, but LOVE it!
I am listing sub navigation in the sidebar only for pages “parents” that have children. It works great, but I can’t figure out how to add the title of the current parent above the list??
Here’s the code:<?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
Here it is in action:
Page with children
Page with no children
I feel like if I had a better grip on the syntax of php I could easily get this. Being a beginner though, I find it VERY confusing??Anybody lend a quick hand?
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘If children, parent title, if not, No title!’ is closed to new replies.