PHP code example of moxie-lean / wp-widgets

1. Go to this page and download the library: Download moxie-lean/wp-widgets library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

moxie-lean / wp-widgets example snippets




[
    'lean' => [],
    'custom' => [],
]

\Lean\Widgets\Register::init([
    'lean' => [
        'LeanPreview',
        'LeanMenu,
    ],
    'custom' => [
        'MyProject\Widgets\MyCustomWidget'
    ],
]);

register_sidebar(
    [
        'id' => 'my-sidebar',
        'name' => 'Name',
        'description' => 'My new sidebar',
    ]
);

use Lean\Widgets\Models\AbstractWidget;

class MyWidget extends AbstractWidget {
	public function __construct() {
		parent::__construct( 'My Widget', 'Displays something really cool.' );
	}
}

public static function post_registration() {
    if ( function_exists( 'acf_add_local_field_group' ) ) :
    endif;
}

public function get_data() {
    $data = parent::get_data();
    		
    return array_merge( ['more_data' => 'something'], $data );
}

public function widget( $args, $instance ) {
    
__construct()