Download the PHP package jazzman/custom-post-type without Composer

On this page you can find all versions of the php package jazzman/custom-post-type. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package custom-post-type

WP Custom Post Type Class

Codacy Badge A single class to help you build more advanced custom post types quickly.

Installation

Creating a new Custom Post type

To create the post type simply create a new object

The optional second parameter is the arguments for the post_type. see WordPress codex for available options.

The Class uses the WordPress defaults where possible.

To override the default options simply pass an array of options as the second parameter. Not all options have to be passed just the ones you want to add/override like so:

See the WordPress codex for all available options.

Existing Post Types

To work with exisiting post types, simply pass the post type name into the class constructor

Adding Taxonomies

You can add taxonomies easily using the register_taxonomy() method like so:

this method accepts two arguments, names and options. The taxonomy name is required and can be string (the taxonomy name), or an array of names following same format as post types:

Again options can be passed optionally as an array. see the WordPress codex for all possible options.

Existing Taxonomies

You can add exisiting taxonomies to the post type by passing the taxonomy name through the register_taxonomy method. You will only need to specify the options for the custom taxonomy once, when its first registered.

Admin Edit Screen

Filters

When you register a taxonomy it is automagically added to the admin edit screen as a filter and a column.

You can define what filters you want to appear by using the filters() method:

By passing an array of taxonomy names you can choose the filters that appear and the order they appear in. If you pass an empty array, no drop down filters will appear on the admin edit screen.

Columns

The Class has a number of methods to help you modify the admin columns. Taxonomies registered with this class are automagically added to the admin edit screen as columns.

You can add your own custom columns to include what ever value you want, for example with our books post type we will add custom fields for a price and rating.

You can define what columns you want to appear on the admin edit screen with the setColumns() method by passing an array like so:

The key defines the name of the column, the value is the label that appears for that column. The following column names are automagically populated by the class:

Populating Columns

You will need to create a function to populate a column that isn't automagically populated.

You do so with the setPopulateColumns() method like so:

so we can populate our price column like so:

The method will pass two variables into the function:

These are passed to help you populate the column appropriately.

Menu Icons

Dashicons

With WordPress 3.8 comes dashicons an icon font you can use with your custom post types. To use simply pass the icon name through the setMenuIcon() method like so:

For a full list of icons and the class names to use visit https://developer.wordpress.org/resource/dashicons/


All versions of custom-post-type with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
jazzman/autoload-interface Version ^0.3.1
jazzman/pluralizer Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jazzman/custom-post-type contains the following files

Loading the files please wait ....