Naming Conventions

WordPress Fuel - Naming Conventions


In order to write a plugin, you need to make sure you follow the conventions. Most of the naming conventions are for autoloading resources and they are prefixes.

  • Model Class: Every model class name must start with 'mod'
  • Controller Base Class: If you want to extend the base controller, class name must start with 'ctr'
  • Short code Class: Short code handler class name must start with 'sco'
  • Helper Class: Helper class name must start with 'hlp'
  • WP Fuel Core Classes: Core system classes can be found in 'wpfuel/core/classes' and they starts with 'cls'
  • Core Abstract Classes: Core system abstract classes can be found in 'wp-content/plugins/wpfuel/core/classes/abstract' and they starts with 'abs'
  • Core Exceptions: Core system exceptions classes can be found in 'wp-content/plugins/wpfuel/core/classes/exceptions' and they starts with 'exp'

  • Please note you must not include prefix while creating a file. Example, if you want to write a model 'modPortfolio' then the filename must be lowercase and it should be stored in 'wp-content/plugins/yourplugin/mvc/models/portfolio.php'


Examples

All the files must be placed inside the plugin folder. Please see WordPress Fuel folder structure for more details.

Declaring Models

mod is prefix here for creating models.

modPortfolio

wp-content/plugins/yourplugin/mvc/models/portfolio.php

modPortfolio_Item_Comments

wp-content/plugins/yourplugin/mvc/models/portfolio/item/comments.php

Declaring Helpers

hlp is prefix for creating helper classes.

hlpUrl

wp-content/plugins/yourplugin/mvc/helpers/url.php

hlpArray_Combo_Dataset

wp-content/plugins/yourplugin/mvc/helpers/array/combo/dataset.php

Declaring Short code Classes

sco is prefix here for creating Short code classes.

scoForm

wp-content/plugins/yourplugin/mvc/shortcodes/form.php

scoForm_Ajax

wp-content/plugins/yourplugin/mvc/shortcodes/form/ajax.php