Plugin Structure - OOP

<?php
/**
 * Plugin Name: BENA Core
 * Plugin URI: https://staging.benadigital.com/
 * Description: Remove WordPress Widgets, Add Custom Welcome Panel, Add Custom Shortcodes, Change Admin Footer Text, 
 * Change WordPress Login Logo, Remove Admin Notices
 * Version: 2.2
 * Author: BenaDigital
 * Author URI: https://staging.benadigital.com/
 * Text Domain: bena-core
 *
 * @package Bena Core
 */

// Prevent Direct File Access
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// Create Class
class bena_core {

    // Constructor 
    public function __construct() {
        add_action('admin_enqueue_scripts', array($this, 'enqueue_scripts'));
        $this->include_files();
    }
    // Styles and Scripts
    public function enqueue_scripts() {
        wp_enqueue_style('bena_core', plugins_url('assets/css/style.css', __FILE__));
        // wp_enqueue_script('bena_core', plugins_url('assets/js/script.js', __FILE__), false );
    }
    // Include Files
    public function include_files() {
        define('BENA_CORE_PATH', plugin_dir_path(__FILE__)); 
        require_once BENA_CORE_PATH . 'includes/setup.php';
        require_once BENA_CORE_PATH . 'includes/welcome-panel.php';
        require_once BENA_CORE_PATH . 'includes/custom-shortcodes.php';
    }
}

// Add a Global variable if you need to use outside of instantiated scope
Global $bena_core;

// Instantiate
$bena_core = new bena_core();
[instagram-feed feed=1]
© 2024 BenaDigital Limited | All Rights Reserved
magnifiercrosschevron-down