Using WordPress as a simple CMS

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 } ?>
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Technorati
  • TwitThis
  • Tumblr

7 Responses to “Using WordPress as a simple CMS”

  1. thanx to share this information

  2. Great code!! Thanks for share!

  3. David says:

    Do you have an example of this code working on a site, so we can see what effect this actually gives?

  4. kuba says:

    @David: sure, check http://www.eventum.com.pl/, unfortunaltely it is only in Polish

  5. Great piece of code I will be using this in the future, your site looks amazing aswell, well done

    Paul

  6. Robin says:

    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

  7. danny clarke says:

    Great code!! Thanks for share!

Leave a Reply

Drop us a line...

 

cforms contact form by delicious:days

Facebook

WordPress ©2010 oldloft. All rights reserved. We're listening, so contact us.