1. Home
  2. Docs
  3. Simpods MVC
  4. Tutorials
  5. Controllers
  6. How To Create A Frontend Controller

How To Create A Frontend Controller


Frontend controllers are located under the /mvc/control/ directory and must extend the Ctrl_MVC_Front_Controller class. The class name must be Ctrl and the remainder of the file path must echo the path to the template file, remember that this follows the standard WordPress hierarchy. The Show Frontend Controller Path setting on the Custom Controllers settings page can be used to show the correct filename.

Naming Examples

Type/Page Template Filename Controller Filename
Default page template page.php mvc/control/page.php
Custom page template templates/template-sample.php mvc/control/templates/template-sample.php
Post archives archive.php mvc/control/archive.php
Single post – default template single.php mvc/control/single.php
Single post – custom post type single-type.php mvc/control/single-type.php

Example File

A minimal template is located in the /mvc/control/templates/template-sample.php file.