Use Constants To Integrate WordPress In Other CMS

Sometimes you need to integrate WordPress into another CMS, like Typo3, Drupal or whatever is out there. The blog should have the same design, use same images and Javascript or implement existing links. Mostly you run the WordPress blog on a subdomain like and the data lies on and so on.

The easiest solution in such cases is to use constants, to access the existing files. We define them in functions.php of the theme folder:

define('DIR_ROOT', '');
define('DIR_STYLESHEETS', DIR_ROOT . '/css');
define('DIR_IMAGES', DIR_ROOT . '/images');
define('DIR_JAVASCRIPT', DIR_ROOT . '/js');

In your theme you use the constants like this:

<script src="<?php echo DIR_JAVASCRIPT; ?>/myeffects.js" type="text/javascript"></script>
<img src="<?php echo DIR_IMAGES; ?>/myimage.jpg" alt="foo" />

Easy, right? Mostly a little stylesheet is enough for special WordPress adjustments, which you load after the stylesheets of the CMS.

Comments are closed.

One comment

  1. Jauhari

    I still confused how to Implemented this method 🙁