PHP code example of realtyna / wp-plugin-framework
1. Go to this page and download the library: Download realtyna/wp-plugin-framework 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/ */
protected function components(): void
{
$this->addComponent(YourComponent::class);
}
protected function adminPages(): void
{
$this->addAdminPage(YourAdminPage::class);
}
protected function boot(): void
{
// Set the container in the App class for global access.
App::setContainer($this->container);
if($this->config->get('log.active')){
Log::init($this->config->get('log.path'), $this->config->get('log.level'));
}
}
protected function migrations(): void
{
$this->addMigration(CreateYourTableMigration::class);
}
namespace MyCompany\MyPlugin\Components;
use Realtyna\MvcCore\Abstracts\ComponentAbstract;
class MyComponent extends ComponentAbstract
{
public function register()
{
// Register your component actions and filters here
}
public function postTypes()
{
$this->addPostType(MyCustomPostType::class);
}
public function subComponents()
{
$this->addSubComponent(MySubComponent::class);
}
public function adminPages()
{
$this->addAdminPage(MyAdminPage::class);
}
public function ajaxHandlers()
{
$this->addAjaxHandler(MyAjaxHandler::class);
}
public function shortcodes()
{
$this->addShortcode(MyShortcode::class);
}
public function restApiEndpoints()
{
$this->addRestApiEndpoint(MyRestApiEndpoint::class);
}
public function widgets()
{
$this->addWidget(MyWidget::class);
}
public function customTaxonomies()
{
$this->addCustomTaxonomy(MyCustomTaxonomy::class);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.