Download the PHP package grottopress/wordpress-metaboxes without Composer

On this page you can find all versions of the php package grottopress/wordpress-metaboxes. 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 wordpress-metaboxes

WordPress Metaboxes

Description

A library to set up metaboxes in WordPress.

Usage

Install via composer:

composer require grottopress/wordpress-metaboxes

Use thus:

<?php

use GrottoPress\WordPress\Metaboxes\MetaboxesTrait;

/**
 * Define your own metaboxes class
 */
class My_Metaboxes_Class {
    /**
     * Import the metaboxes trait
     */
    use MetaboxesTrait;

    /**
     * Define your metaboxes with the `metaboxes` method
     */
    protected function metaboxes( WP_Post $post ): array {
        $boxes = [];

        if ( \is_post_type_hierarchical( $post->post_type ) ) {
            $boxes[] = [
                'id' => 'my-metabox-1',
                'title' => \esc_html__( 'My Metabox 1' ),
                'context' => 'side',
                'priority' => 'default',
                'screen' => 'page',
                'fields' => [
                    [
                        'id' => 'my-metabox-1-field-1',
                        'type' => 'select',
                        'choices' => [
                            'left' => \esc_html__( 'Left' ),
                            'right' => \esc_html__( 'Right' ),
                        ],
                        'label' => \esc_html__( 'Select direction' ),
                        'label_pos' => 'before_field', // or 'after_field'
                    ],
                ],
                'notes' => '<p>' . \esc_html__( 'Just a super cool layout metabox example' ) . '</p>',
            ];
        }

        $boxes[] = [
            'id' => 'my-metabox-2',
            'title' => \esc_html__( 'My Metabox 2' ),
            'screen' => 'post',
            'fields' => [
                [
                    'id' => 'my-metabox-2-field-1',
                    'type' => 'text',
                    'label' => \esc_html__( 'My first field' ),
                    'label_pos' => 'before_field', // or 'after_field'
                    'sanitize_callback' => 'sanitize_text_field',
                ],
                [
                    'id' => 'my-metabox-2-field-2',
                    'type' => 'email',
                    'label' => \esc_html__( 'My second field' ),
                    'label_pos' => 'before_field', // or 'after_field'
                    'sanitize_callback' => 'sanitize_email',
                ],
                [
                    'id' => 'my-metabox-2-field-3',
                    'type' => 'url',
                    'label' => \esc_html__( 'My third field' ),
                    'label_pos' => 'before_field', // or 'after_field'
                    'sanitize_callback' => 'esc_url',
                ]
            ],
            'notes' => '<p>' . \esc_html__( 'My awesome metabox example.' ) . '</p>',
        ];

        return $boxes;
    }

}

// Add your metaboxes to WordPress
$metaboxes = new My_Metaboxes_Class();
$metaboxes->setup();

All versions of wordpress-metaboxes with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
grottopress/wordpress-field Version ^0.3
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 grottopress/wordpress-metaboxes contains the following files

Loading the files please wait ....