Integrating WordPress Within My Site

My goal was to incorporate WordPress blog functionality within my existing site.

These are useful resources in understanding how WordPress works:

WordPress Installation and Theme Change

These are the steps to install WordPress and create a new theme, containing any relevant resource links.

  1. WordPress installation
  2. In the new WordPress installation I created a new directory within the themes/wp-content directory. I gave this directory the name of new theme.
  3. I created style.css within new theme directory. This does require a mandatory comment header for WordPress to identify the theme – see theme stylesheet directions.
  4. Then I changed to my theme within WordPress

At this point the WordPress installation presented a blank page as the templates had yet to be created.

Template Creation

This site uses WordPress post functionality, anonymous commenting and the blog search functionality. The WordPress theme development page contains a list of templates files that can be updated and included. These are the templates I customised for this blog.

  1. index.php – template for the home page of the blog. See Theme Development – index.php.
  2. single.php – template to display single posts. See Theme Development – single.php.
  3. comments.php – specifying how comments and the comments form will be displayed. See Function Reference/comments template.
  4. search.php – customising the search page and how search results are displayed. See Creating a Search Page.
  5. searchform.php – to customise the search form. See Function Reference/get search form.
  6. functions.php – to change default behaviour of WordPress. See Functions Explained. My file removes code that was causing any page containing the category list not to validate. See Make your WordPress category list valid by removing the “rel” attribute.
  7. 404.php – when a post cannot be found through a broken link. See Creating an Error 404 Page.
  8. For the pages including a categories list I replaced the get_categories function with the get_the_category_list function for more control over the code produced.

Incorporating Site Features on Blog Pages

I had already used PHP includes for the header, footer and navigation of my basic site and these were included in the template pages.

Post Update – 11th September 2013

I used the following HTML5 time element with WordPress functions for the post date.

<time datetime="<?php the_time('Y-m-d') ?>"><?php the_time(get_option('date_format')); ?></time>

To include the date in a format required by the datetime attribute involved the use of the WordPress PHP function thetime() rather than thedate() as the latter only works once for posts published on the same date.

Leave a Reply

Your email address will not be published.