WordPress as a CMS

I’ve been working on a public website over these last few months and one of the issues I faced was what mechanism to use so that our users could edit the content of some of the pages. I’ve been using WordPress successfully for awhile now on this site, and it somehow popped into my head that I could also use WordPress as a CMS, not just a blogging system. I blogged a couple days about how to get an unordered list of posts from WP. Now for how to use WP as a link manager and content editor.

Link manager

As usual, make sure you put this PHP snippet at the beginning of the non-wordpress page that will make calls to WordPress

<?php require(‘path-to-wordpress-install/wp-blog-header.php’); ?>

In the WordPress admin, take note of the ID number of the category you want to pull the links from.

Category List

Then place this PHP snippet in the non-wordpress page where you want the links to appear.

<ul class=”navlist”>
<?php get_links(2, ‘<li>’, “</li>”, “\n”, true, ‘name’, false); ?>

Content Manager

Back in the WP admin area:

  1. Create a new page
  2. Enter a title
  3. Enter your content in the editor
  4. Turn off comments and pings if you so desire
  5. Save the page and take note of the post slug. This will generally be the title in lowercase with the spaces removed from it.

On your non-wordpress PHP page:

<?php query_posts(‘pagename=postslug‘);
if (have_posts()) : while (have_posts()) : the_post();
endwhile; endif;

This is working out great. WordPress can easily be used as a link manager, cms, and publishing platform. I’ll post more as I discover more ways to utilize the system. If you have any WordPress tips or tricks, share them in the comments.

1 thought on “WordPress as a CMS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.