kostyandrew/aspect-post

PHP Class for WordPress which help create type of post, taxonomies and metabox

Installs: 22

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:wordpress-plugin

1.0.0 2025-03-10 23:19 UTC

This package is not auto-updated.

Last update: 2025-07-15 23:10:56 UTC


README

PHP Class for WordPress which help create type of post, taxonomies and metabox

You can use standard arguments and labels setting WordPress using setArgument and setLabel methods

Creating post type:

use \Aspect\Type;
$slides = new Type('slide');
$slides
  ->addSupport('thumbnail') // add support thumbnail
  ->setArgument('public', true) // public argument
  ->setArgument('show_in_nav_menus', false); // hide in creating menu

Creating taxonomy:

use \Aspect\Taxonomy;
$slides_type = new Taxonomy('type');
$slides_type
  ->attachTo($slides); // post type where will be created taxonomy

Creating metabox:

use \Aspect\Box;
$slides_settings = new Box('slide setting');
$slides_settings
  ->attachTo($slides); // post type

Creating metabox input:

use \Aspect\Input;
$text_color = new Input('text color');
$text_color
  ->attachTo($slides_settings) // metabox
  ->attach('white', 'black') // values for select
  ->setType('select') // type of input
  ->setArgument('default', 'black'); // default

Get value of metabox field:

$text_color = Input::get('text color')->getValue($slide_id, 'attr', Box::get('slide setting'));