D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
etb1lp46s9ed
/
public_html
/
a3legalservices.site
/
wp-content
/
plugins
/
aeen-core
/
widgets
/
Filename :
init.php
back
Copy
<?php /** * @author RadiusTheme * @since 1.0 * @version 1.0 */ namespace radiustheme\Aeen_Core; class Custom_Widgets_Init { public $widgets; protected static $instance = null; public function __construct() { $widgets1 = array( 'post' => 'Post_Widget', 'contact' => 'contact_Widget', 'about-widget' => 'About_Widget', 'practice-post' => 'Practice_Post_Widget', 'footer-post' => 'Footer_Post_Widget', 'contact-social' => 'Contact_Social', ); $widgets2 = array(); $this->widgets = array_merge( $widgets1, $widgets2 ); add_action( 'widgets_init', array( $this, 'custom_widgets' ) ); } public static function instance() { if ( null == self::$instance ) { self::$instance = new self; } return self::$instance; } public function custom_widgets() { if ( !class_exists( 'RT_Widget_Fields' ) ) return; foreach ( $this->widgets as $filename => $classname ) { $file = dirname(__FILE__) . '/' . $filename . '.php'; $class = __NAMESPACE__ . '\\' . $classname; require_once $file; register_widget( $class ); } } } Custom_Widgets_Init::instance();