Download the PHP package gebruederheitz/wp-easy-post-options without Composer

On this page you can find all versions of the php package gebruederheitz/wp-easy-post-options. 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 wp-easy-post-options

Wordpress Easy Post Options

Extend posts with meta fields / options using a simple, modern interface.


Installation

via composer:

Make sure you have Composer autoload or an alternative class loader present.

Usage

This package offers a bunch of interfaces, abstract classes and handler classes that simplifies adding "post meta" to posts or pages in Wordpress.

To enable the basic functionality, you'll have to load the initializer class, either in your functions.php or somewhere in a controller class or container module:

Creating meta boxes

Each custom option will need to be added to a meta box (which can contain multiple options). To easily create a meta box, use the AbstractMetabox class:

Restricting the post type(s) a metabox is displayed on

By default, meta boxes are shown on all posts of the types 'post' and 'page'. You can customize this behaviour by declaring a static class attribute $postTypes:

Changing where a meta box is shown

Similarly, you can customize the meta box's location by providing the static class attribute $context, set to any of side, normal or advanced (blame Wordpress, not me!):

Adding post options

Once your meta box is created, you can add settings to it. The quickest way is by extending AbstractPageOrPostOption:

Then, make sure you instantiate that class somewhere (usually this will be your functions.php), along with the meta box the input should live in:

For a basic text input field that's it, your're done. You can then retrieve the value by calling the static getValue() method on your custom class:

Displaying a boolean option using a checkbox field

The library offers another little helper for displaying simple checkbox fields:

Modifying the inputs and value parsing

In order to customize the form controls rendered into the metabox, you can override the render() method of the base class.

Note: wp-easy-post-options and adretto-extension-simple-post-options

This package is developed and maintained in parallel with sillynet/adretto-extension-simple-post-options, which offers the same basic functionality, but is written to embed itself into the Adretto microframework (a work in progress). In the future it is likely that one of these two packages will reuse most of the code from the other one, in order to avoid large-scale code duplication. This will however most likely have no effect on the public API of either project.

Development

Dependencies


All versions of wp-easy-post-options with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
gebruederheitz/wp-meta-fields Version ^1.3
gebruederheitz/simple-singleton 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 gebruederheitz/wp-easy-post-options contains the following files

Loading the files please wait ....