WordPress.org

Forums

[resolved] Adapting WordPress to a CMS (4 posts)

  1. sugar_man
    Member
    Posted 7 years ago #

    Hi,
    I'm trying to modify WordPress so I can use it as a CMS for my website http://www.nooryouthonline.com. At the moment I use Cutenews but its not very secure and user-friendly.

    Reading around Codex, it seems the most popular way to set up a CMS is to make the whole layout in WordPress, setting a page as 'home', editing templates, creating new themes and that sort of thing.

    I already have a layout designed using xHTML and CSS so I would prefer to just include the content from posts and pages that I make in WordPress. I have installed WordPress in a folder called /wp in the root directory, but I cannot find away of using a simple PHP include function to call content from published posts and pages into a file e.g. events.php in the root directory. Basically I do not know what page, file or function to include.

    Any help would be greatly appreciated. If this sort of thing isn't possible in WordPress, can anyone recommend a more suitable CMS script?

  2. Eric Amundson
    Volunteer Moderator
    Posted 7 years ago #

    Hey Sugar_man,

    I use WP as a CMS all the time on customer sites and I always build a CSS/xHTML template and then connect it into WordPress, creating a custom 'theme' for the site.

    If you're new at this, there's a lot of info in the Codex Documentation on creating themes and templates - Google can help you find a lot too.

    A few weeks back, I picked up WordPress Theme Design by Tessa Blakely Silver and if you're just starting out, it's well worth the money (currently about $29 USD).

    She walks you through creating a design, and making it into a theme.

    I'm sure there are ways to 'include' info from the WordPress database into an exterior (to WordPress) page, but I've never done it and don't see the point.

  3. sugar_man
    Member
    Posted 7 years ago #

    Thanks for the advice sewmyheadon. I appreciate that creating themes and templates, and using the is_home() template tag to create a static homepage is the obvious way to use WordPress as a CMS. However I'm not interested in this as I have already done all the work of creating a layout in xHTML and CSS files and do not want to rework everything all over again.

    Thus the simplest solution for me is to 'include' info from the WordPress database into an exterior page as you said. I guess what I'm looking for is how WordPress generates a post or page from the database (being 'dynamic'), and the back-end stuff behind the the_content() template tag, which in Codex is described as "the meat and potatoes of each pass through The Loop", so I have an idea of what I can 'include'.

  4. sugar_man
    Member
    Posted 6 years ago #

    I've RESOLVED it.

    Basically I found a function called query_posts(). What this does is directly query the database for particular posts or pages, and using The Loop and Template Tags, can retrieve specific records, in the example below the title and content. Full details of using this function, including the conditions you can place like 'posts per page' can be found on the User:JamesVL/query posts codex article.

    Example:

    <?php query_posts('cat=4'); ?>
      <?php if (have_posts()) : while (have_posts()) : the_post();?>
      <p class="header">
      <?php the_title();?>
      </p>
      <?php the_content() ?>
      <?php endwhile; else: ?>
       Sorry, there has been an error!
    Please report this to the webmaster by sending an email to bla@blabla.com
      <?php endif; ?>

    Actual web page is http://www.nooryouthonline.com/?pg=audio

Topic Closed

This topic has been closed to new replies.

About this Topic