English (United Kingdom)
1.4.0

This is the widget main file.

Here below you can see an example of a widget:

<?php
/**
 * @package     VikRentCar
 * @subpackage  custom_two_admin_widget
 * @license     GNU General Public License version 2 or later; see LICENSE
 * @link        https://vikwp.com
 */

defined('ABSPATH') or die('No script kiddies please!');

/**
 * Class handler for admin widget "custom two".
 * 
 * @since 	1.4.0
 */
class VikRentCarAdminWidgetCustomTwo extends VikRentCarAdminWidget
{
	/**
	 * Class constructor will define the widget name and description.
	 */
	public function __construct()
	{
		// call parent constructor
		parent::__construct();

		$this->widgetName = 'Custom Two';
		$this->widgetDescr = 'Description for admin widget custom two...';
	}

	/**
	 * Render method will output the content of the widget.
	 */
	public function render($data = null)
	{
		?>
		<div class="vrc-admin-widget-wrapper">
			<div class="vrc-admin-widget-head">
				<h4><?php echo $this->getName(); ?></h4>
			</div>
			<div class="vrc-admin-widget-body">
				<?php echo '<p class="info">Hey, I am a custom admin widget for VikRentCar called &quot;' . $this->getName() . '&quot;.</p>'; ?>
				<p>I can send HTML contents to output, and I can perform operations through PHP.</p>
			</div>
		</div>
		<?php
	}
}
Last Update: 2021-11-17
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information