Main Class

The framework works using with a master class called Main.php and which is located at the theme folder for themes and plugin folder for plugins.

This class acts like a bridge between WordPress and the template, meaning that any Hook (say WordPress action or filter) should be declared inside this class.

It is very similar to a routing file, term commonly used in frameworks like Laravel.

WordPress Hooks

Main.php has two main methods.


Where all public hooks should be declared. Meaning public, by all those which will not interact with the admin dashboard.


Where all admin hooks should be declared. Those who will interact with the admin dashboard.


The following example is filtering the content displayed in a post:

Notice how the add_filter is registering a call to the method filter_content within Main.php by calling &$this (variable as reference).

You can do the same with admin hooks and filters, the only difference is that these should be located inside the on_admin() function:

External Access

Main.php can be accessed externally by plugins or templates.

On themes

Access by calling to the $theme variable.


On plugins

Access by calling to a variable named the same as the name set with ayuco during installation (but lower-cased). For example, if the name was MySpecialPlugin the variable to call should be $myspecialplugin.