2017 © Pedro Peláez
 

wordpress-plugin wp-admin-utility

Create admin pages and post types via declarative config files

image

dwalkr/wp-admin-utility

Create admin pages and post types via declarative config files

  • Monday, February 26, 2018
  • by dwalkr
  • Repository
  • 2 Watchers
  • 3 Stars
  • 6,084 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 1 Open issues
  • 17 Versions
  • 10 % Grown

The README.md

WordPress Admin Page Utility

wp-admin-utility installs as a plugin and provides an API for quickly setting up custom post types and options pages. Whereas other post type builders provide an admin interface for creating post types, this utility reads static configuration files to create post types via a declarative syntax., (*1)

Installation

composer require dwalkr/wp-admin-utility

Basic Usage

The PageCreator singleton is used to parse configuration files. It is made available on a custom hook named adminutility-pagecreator-init. The hook is triggered on after_setup_theme, so just be sure you add your callback before that event (plugins can use plugins_loaded and themes can just put their code directly in functions.php.), (*2)

Use the addPostType method to create post types, and addSettingsPage to create options pages., (*3)

<?php

add_action('adminutility-pagecreator-init', function($pageCreator){
  $pageCreator->addPostType('/path/to/config.yml');
});

Configuration Formats

Configuration files can be in yaml, json, or php format. When passing a PHP file to PageCreator, the file should return the configuration as an associative array., (*4)

Direct Array/Object Config

Instead of having PageCreator parse a configuration file, you can pass an array or PHP object containing the configuration instead of the path to a file. Use the FROM_ARRAY and FROM_OBJECT constants to tell PageCreator how to process the first method parameter., (*5)

<?php

$config = [
  'active' => true,
  'name' => 'specials',
  'public' => true
  //...
];
$pageCreator->addPostType($config, \dwalkr\WPAdminUtility\PageCreator::FROM_ARRAY);

Configuration API

Almost all options that can be passed into the register_post_type function can be added to the top-level config for a post type., (*6)

To understand how to set up meta boxes with custom fields, see the post type example., (*7)

To understand how to set up settings pages, see the settings page example., (*8)

Adding Custom Meta Boxes to Existing Post Types

To add a custom fields and meta boxes to an existing post type, just add a configuration file with the name property matching the existing post type. If the post type has already been registered, the rest of the top-level configuration is ignored and only metaboxes are added., (*9)

The Versions

26/02 2018

dev-master

9999999-dev https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

26/02 2018

v0.5.1

0.5.1.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

06/12 2017

v0.5.0

0.5.0.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

15/09 2017

v0.4.2

0.4.2.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

28/06 2017

v0.4.1

0.4.1.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

19/05 2017

v0.4.0

0.4.0.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

19/05 2017

v0.3.5

0.3.5.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

19/05 2017

v0.3.4

0.3.4.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

18/05 2017

v0.3.3

0.3.3.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

10/05 2017

v0.3.2

0.3.2.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

25/04 2017

v0.3.1

0.3.1.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

25/04 2017

dev-#9-checkbox-save-problem

dev-#9-checkbox-save-problem https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

13/04 2017

v0.3.0

0.3.0.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

24/10 2016

v0.2.2

0.2.2.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

11/09 2016

v0.2.1

0.2.1.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

05/06 2016

v0.2.0

0.2.0.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress

28/05 2016

v0.1.0

0.1.0.0 https://github.com/dwalkr

Create admin pages and post types via declarative config files

  Sources   Download

MIT

The Requires

 

wordpress