Wordpress - Installation and setup

The Outlast Framework WordPress plugin allows you to use the blog engine as the framework’s content management system.


To install the WordPress plugin add the folder to Outlast Framework’s plugin folder (or add it as a submodule), enable the plugin the site/index.php settings file, and then visit the update / installation page (http://example.com/update/install/) to follow the on-screen directions. You’ll need to update the .htaccess file before WordPress kicks in.

Post-installation tasks

You should perform the following tasks after installation:

  1. Enable the Mozajik Light - Outlast Framework WordPress theme – this is included in the installation
  2. Add {% wp_head %} to the <head> section of your base template
  3. Add {% wp_footer %} just before the final </body> tag in your base template
  4. Create a __wpload() magic method in your default.ctl.php file
  5. Go to Settings / Permalinks and set the Post Name mode. Ignore any .htaccess change requests and make sure it didn’t automatically edit the file
  6. Go to Settings / Reading and set a static front-page (optional)

Creating the most basic template files

First create the file app/view/wordpress/post.html. This is the same as “single.php” in WordPress -or in other words- it is the template which is displayed when a single post is shown.

Next, for pages, create the file app/view/wordpress/page.html. This is the same as “page.php” in WordPress -or in other words- it is the template which is displayed when a single page is shown.

In each file you can use the template tags supported by Outlast Framework’s WordPress plugin.

Using __wpload() instead of functions.php

Most of the time you do not need to modify the WordPress template’s functions.php, instead you can add any code to the __wpload() magic method. You should add this function to your default.ctl.php:

/** File: app/controller/default.ctl.php  **/
 * Load up WordPress customizations (functions.php stuff)
public function __wpload(){
	// Now add some widgets
		// register_sidebar.....
	// Add some menus
		// etcetc.
	// Do any other required WP actions...
		// You can use all WP functions here!

Registering templates in __wpload() instead of creating template php files

In a typical WordPress plugin you would create specially named php files in your WordPress template folder and add special comment blocks on the top, etcetc. This is not needed in Outlast Framework’s WP plugin.

Instead, the workflow typically consists of registering templates in the __wpload section of the default.ctl.php file. Read more about this in the next section.

Using WordPress themes

Using WordPress themes is generally not recommended because one of the advantages of the Outlast Framework is its superior MVC structure. However, sometimes it just does not make sense to recreate an existing WordPress template the OFW-way – in this case you can simply use the WordPress template without modification and as you normally would. Place the template in the wp-content/themes/ folder.

Some Outlast Framework features (such as __wpload and custom OFW templates) will not work as expected in this case.

Using WordPress plugins

You are free to use any WordPress plugins and most of the time they should work together with OFW’s WordPress version with little or no changes required.

Place the plugin in the wp-content/plugins/ folder.

Using wp-content at the _project level

When you insert the wordpress folder into your Outlast Framework’s plugin folder it will be a fixed WP version that you can easily be upgraded when a new OFW-compatible version comes out by switching it out with the new version. You can also use folder as a submodule so that it points directly to our regularly updated version controlled git repo.

However, if you want to make modifications in wp-content (for example by adding new themes or plugins) you should not edit the /plugins/wordpress/ version. This would edit the plugins available to all sites not just the current one.

Instead, you should copy the wp-content to the /plugins/_project/site/wordpress/wp-content/ location. This folder is associated with your specific project and not with the globally updated OFW wordpress plugin. It will allow you to easily receive updates from the submodule or via a simple download and drop-in replacement.

Here are the steps for using project-level wp-content:

  1. copy all the contents of /plugins/wordpress/site/wp-content/ to /plugins/_project/site/wordpress/wp-content/ location
  2. remove the comment from the first line of the WordPress-related rules in your .htaccess file – an example is below

Example htaccess file:

	# Uncomment line below if you are using custom wp-content folder in _project/site/wp-content/
	# RewriteRule ^wp-content/([A-z0-9-./]*) plugins/_project/site/wordpress/wp-content/$1?zajwordpress=305&zajhtver=305&zajapp=$1&zajmode=$2&%{QUERY_STRING} [L]
	RewriteRule ^(wp-[A-z0-9-./]*) plugins/wordpress/site/$1?zajwordpress=305&zajhtver=305&zajapp=$1&zajmode=$2&%{QUERY_STRING} [L]
	RewriteRule ^([^/.]+)/(.+) plugins/wordpress/site/index.php?zajwordpress=305&zajhtver=305&zajapp=$1&zajmode=$2&%{QUERY_STRING} [L]
	RewriteRule ^([^/.]*)(/)?(.*) plugins/wordpress/site/index.php?zajwordpress=305&zajhtver=305&zajapp=$1&zajmode=&%{QUERY_STRING} [L]
	RewriteRule (.+)? plugins/wordpress/site/index.php [L]
Outlast Web & Mobile Development (c) 2023 | Privacy Policy |