WordPressMVC

  1. Get Started
  2. Documentation
  3. Tutorials
  4. Blog
  1. Documentation
  2. Tutorials
v1.0.8 Login
  • Blog
  • Download
  • Get Started
  • The Basics
    • Ayuco
    • Main Class
    • Configuration
  • Hooks
    • Actions
    • Filters
    • Widgets
    • Shortcodes
  • MVC
    • Models
    • Post Models
    • Option Models
    • Term Models
    • User Models
    • Views
    • Controllers
  • Resources
    • Assets
    • Styles
    • Scripts
  • Advanced
    • Request
    • Response
    • Localization
    • Cache
    • Logger
    • Database
    • Testing
    • Deployment
    • Functions
    • Add-ons

Widgets

Last updated: January 12, 2020

WordPress Widgets can be registered with Ayuco or added manually to the Main Class.

Ayuco Command

php ayuco register widget:{widget}
{widget} The widget's class name (i.e. MyWidget).

Example:

php ayuco register widget:MyWidget

Ayuco will create a new folder, called "Widgets", inside the framework's "app" folder and will create the class named in the command.

Add Manually

Stop And Think

Register widgets with Ayuco solves many issues, such as loading classes under no namespace and linking the Main Class. Is highly recommendable to use Ayuco for when registering widgets.

Class widgets can be added manually by defining them in the Main Class.

class Main extends Bridge
{
    public function init()
    {
        // Manual widget added, widget class "MyWidget".
        $this->add_widget( 'MyWidget' );
    }
}

Ayuco?

When a widget is registered using ayuco, it is defined in the Main Class same as if it would have been defined manually.
© 2023 10 Quality Studio . All rights reserved.
Search in: