Il tuo carrello è vuoto!
File Principale del Plugin
apply_filters( 'vikbooking_load_admin_widgets', array $return )
Fired during the plugin installation, it's necessary to define the widget paths to let VikBooking recognize them as Admin-Widgets for your Dashboard or Multitask Panel.
Description
This hook is needed to create a new native Wordpress plugin that will be used by VikBooking to extend its widgets framework and to add the admin-widgets you've created to your VikBooking dashboard and Multitask Panel.
Parameters
- $return
-
Function where you'll return the file paths for the callback of the filter 'vikbooking_load_admin_widgets'
Example
The example below explains how to define two basic VikBooking widgets.
<?php
/*
Plugin Name: VboCustomAdminWidgets
Plugin URI: https://vikwp.com/plugin/vikbooking
Description: Custom admin widgets for VikBooking.
Author: E4J s.r.l.
Author URI: https://vikwp.com
License: GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
// no direct access
defined('ABSPATH') or die('No script kiddies please!');
// register callback for filter "vikbooking_load_admin_widgets"
add_filter('vikbooking_load_admin_widgets', function($return)
{
if (!$return)
{
$return = [];
}
/**
* Since multiple plugins could add their own custom admin widgets, it
* is necessary to always merge the paths to the admin widget files of
* this plugin to any previous widget that may have already been injected.
* Simply define an array of absolute paths to the PHP files that declare
* the needed class by VikBooking to load an admin widget.
*
* In this example, we are telling VikBooking to load two custom admin widgets.
*/
return array_merge($return, [
// WP_PLUGIN_DIR = absolute server path to plugin's directory
// vbocustomadminwidgets = the name of this custom plugin
// admin_widgets = a private/internal folder of this custom plugin
// custom_one.php = the class file that declares the admin widget
WP_PLUGIN_DIR . '/vbocustomadminwidgets/admin_widgets/custom_one.php',
// custom_two.php = the class file that declares the admin widget
WP_PLUGIN_DIR . '/vbocustomadminwidgets/admin_widgets/custom_two.php',
]);
});
Ultimo aggiornamento: 2023-03-28
Utile?
75% delle persone lo ha trovato utile.