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.
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); ?>
</ul>
Content Manager
Back in the WP admin area:
- Create a new page
- Enter a title
- Enter your content in the editor
- Turn off comments and pings if you so desire
- 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();
the_content(“”);
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.
I’m also using WordPress as a CMS for my website; while not an ideal solution, it’s really not bad.
Have a look at the aStickyPostOrderER plugin here, http://pixelplexus.co.za/blog/2007/11/20/plugin-to-change-wordpress-post-order/
This plugin allows you to override the natural order of your posts on your index page. This is sometimes useful for important posts that should remain at the top for a specified amount of time.