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

How To Create An Admin Controller

Location

Admin controllers are located in the /mvc/admin/control/ directory and must extend the Ctrl_MVC_Admin_Controller class. The class name must be Ctrl and the file name is based on the post type being edited: something.php, post lists and editors use the same controller. The rule is that if it is a post type, it will be post-type.php; if not and the variable “page” exists in the url, it will be $_GET[‘page’].php; else, it will just use the request script name, e.g. script.php. The Show Admin Controller Path setting on the Custom Controllers settings page can be used to show the correct filename.

Naming Examples

Type/Page Controller Filename
Standard posts post.php
Custom post type (slug: sample-item ) sample-item.php
Users user.php
General settings options-general.php
plugin/theme-admin-page, namespace is required for plugins to avoid conflicts theme-admin-page.php

Example File

In the Simpods Basic theme, a minimal template is located in the /mvc/admin/control/sample.php file.