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.
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.
<?php get_links(2, ‘<li>’, “</li>”, “\n”, true, ‘name’, false); ?>
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:
if (have_posts()) : while (have_posts()) : the_post();
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.