erimok/uycore

WordPress library

dev-main 2021-08-07 09:18 UTC

This package is auto-updated.

Last update: 2024-05-10 22:32:30 UTC


README

The main idea of the UYCore WordPress library is to decrease development time and have enjoyed the development process. The UYCore library provides a simple way to create a custom WordPress functionality in a few lines of code.

Basics

You have to run init method of UYCore class to initialize work of library features. All calls to the library must be placed before init method of the UYCore class.

\UYCore\UYCore::init();

Custom Post Types

An example of default Custom Post Type registration:

use UYCore\Facades\PostType;

PostType::register('faq');

Custom Taxonomies

An example of default Custom Taxonomy registration:

use UYCore\Facades\Taxonomy;

Taxonomy::register('faq_domain');

Theme support

You are able to add WordPress theme support features via the theme support facade class.

use UYCore\Facades\ThemeSupport;

ThemeSupport::getInstance()
    ->addTitleTag()
    ->addEditorStyles()
    ->addPostThumbnails(['post']);

Security class

Security facade class allows enhancing WordPress website security.

use UYCore\Facades\Security;

Security::secureAll();

As an alternative way, the developer is able to choose available methods in the security class to enhance security.

use UYCore\Facades\Security;

Security::getInstance()
    ->secureApiByAuth()
    ->disableXmlRpc();

Service classes

The library provides access to a bunch of service classes.

Label generator service class

Label generator service class allows creating a custom array of labels for Post Type and Taxonomy by one code line.

use UYCore\Services\LabelGenerator;

$post_type_labels = LabelGenerator::getPostTypeLabels(
    esc_html__('Tip', 'domain'),
    esc_html__('FAQ', 'domain')
));

$taxonomy_labels = LabelGenerator::getTaxonomyLabels(
    esc_html__('Tip category', 'domain'),
    esc_html__('FAQ categories', 'domain')
);