WordPress can be easily used as a simple Content Management System, with couple tweaks it will be a perfect budget solution for some clients. Even without plugins, it is SEO friendly and usable out of the box.
One of the most important features of simple CMS is a layered dynamic menu. WP already supports this feature, we only need to insert small piece of code to get a nice tree structured menu.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <?php $thisPage = get_post($post->ID); if(is_array($thisPage->ancestors)) { $ancestor = end($thisPage->ancestors); } if($ancestor) { // show everything for the top parent $children = wp_list_pages('title_li=&child_of=' . $ancestor . '&echo=0'); } else { // jeśli nie, to dla danej strony $children = wp_list_pages('title_li=&child_of=' . $post->ID . '&echo=0'); } if ($children) { // don't show empty element ?> <ul> <?php echo $children; ?> </ul> <?php } ?> |
thanx to share this information
Great code!! Thanks for share!
Do you have an example of this code working on a site, so we can see what effect this actually gives?
@David: sure, check http://www.eventum.com.pl/, unfortunaltely it is only in Polish
Great piece of code I will be using this in the future, your site looks amazing aswell, well done
Paul
I used wordpress ones as a cms, works great i know. But then i look at a open source cms a view months ago to replace wordpress. I found Drupal. Hallaloeya, just give it a try. Use the Zen Template as a start to theme your website.
Greetz
Great code!! Thanks for share!