Ilk Wordpress Custom Post Type and Taxonomies Creator: Register new WordPress post types and taxonomies

Recommend this page to a friend!
  Info   View files Documentation   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2021-05-21 (4 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 30 All time: 10,282 This week: 200Up
Version License PHP version Categories
ilk 1.0BSD License7PHP 5, Content management, Blogs
Description Author

This package can register new WordPress post types and taxonomies.

It provides a builder class that can be used to register custom post types enabling features like support to be able to access the custom posts via REST API, enabling support to blog features, setting a slug text for internationalization, allow to access the custom post types via a menu, etc..

Another class allows setting a taxonomy to classify new custom types like being able to access the taxonomies via REST API, setting the type of taxonomy to be like a hierarchical category structure, etc..

Innovation Award
PHP Programming Innovation award nominee
April 2021
Number 8
WordPress is a popular content management system that can be extended with plugins.

Creating new custom types and taxonomies to classify the posts in WordPress are some of the possibilities that can be implemented using plugins.

This package makes it easier to create new plugins that implement new custom types and taxonomies, as well provide API calls to manage them using external applications.

Manuel Lemos
Picture of Carlos Artur Curvelo da Matos
  Performance   Level  
Name: Carlos Artur Curvelo da ... is available for providing paid consulting. Contact Carlos Artur Curvelo da ... .
Classes: 17 packages by
Country: Portugal Portugal
Age: 43
All time rank: 323441 in Portugal Portugal
Week rank: 590 Up7 in Portugal Portugal Up
Innovation award
Innovation award
Nominee: 11x

Winner: 2x

Details

Ilk

Codacy Security Scan

Custom post types and custom taxonomies - one of the must-haves for any WP developer or web designers. They allow Wordpress websites to be turned into platforms, services and entire systems. There are thousands of ways of creating post types and taxonomies, and also a number of helper classes and wrappers. So, why do we need yet another?

Most post type helpers have something in common: they are not maintained. With Ilk, we come with a different proposal - to keep things always up-to-date, considering WP core, and launch new features and tools frequently.

Installation

Using Composer, of course: carloswph/ilk, which is the recommended way.

But you can also clone this repo and require the classes files, located in the src/folder, or even autoloading yourself, depending on the script you are using.

Usage

Yeah, we really try to keep things neat and simple. Ilk uses an Illuminati class named Pluralize, which allows you to submit just the singular post type (or taxonomy) name, and the script finds the equivalent plural in English. Perhaps we add some other languages in the future.

Regarding the logic, it is again pretty simple. All you need to do to create a new post type is instancing the Builder class, with the singular post type name:

$cpt = new Builder('Foot'); // The plural 'Feet' is automatically found and generated

$cpt->enableRest(); // If you want the post type to show in rest (default is false)
$cpt->setSupports('excerpt'); // If you want to add any new feature support
$cpt->setI18n('ilk-rulez'); // Sets a slug for translations, if necessary

Other class, TermBuilder, will allow you to create custom taxonomies for those post types you have just built. Logic, again, is quite simple: instatiating the class, using the singular name of the desired taxonomy as first argument and the custom post type class instance as second.

$tax = new TermBuilder('Knife', $cpt); // Again, the plural 'Knives' will be automatically managed

$tax->enableRest(); // Same logic as CPTs
$tax->likeCategory(); // Taxonomies are by default non-hierarchical, but you can make them hierarchical using this method

Other methods

Some other methods can be used. Commonly, we want the new post type menu to appear as submenu in a particular part of the backend. Sometimes, yet, we don't even want a menu to be shown. Both situations can be addressed with this method:

$cpt->setMenu(false); // No post type in backend menu
$cpt->setMenu('options-general.php'); // Post type as submenu for Settings

Also, as feature supports can be added anytime, they could be also removed, by using the following method:

$cpt->dropSupports('excerpt');
  Files folder image Files  
File Role Description
Files folder image.github (1 directory)
Files folder imagesrc (5 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  .github  
File Role Description
Files folder imageworkflows (3 files)

  Files folder image Files  /  .github  /  workflows  
File Role Description
  Accessible without login Plain text file codacy-analysis.yml Data Auxiliary data
  Accessible without login Plain text file composer.yml Data Auxiliary data
  Accessible without login Plain text file php.yml Data Auxiliary data

  Files folder image Files  /  src  
File Role Description
  Plain text file Builder.php Class Class source
  Plain text file Failure.php Class Class source
  Plain text file MetaBuilder.php Class Class source
  Plain text file Plural.php Class Class source
  Plain text file TermBuilder.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:30
This week:0
All time:10,282
This week:200Up
For more information send a message to info at phpclasses dot org.