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.
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
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
Main.php can be accessed externally by plugins or templates.
Access by calling to the
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