PHPackages                             askupa-software/amarkal-metabox - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. askupa-software/amarkal-metabox

ActiveWordpress[Utility &amp; Helpers](/categories/utility)

askupa-software/amarkal-metabox
===============================

A set of utility functions for creating WordPress metaboxes

421[2 issues](https://github.com/amarkal/amarkal-metabox/issues)PHP

Since Dec 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/amarkal/amarkal-metabox)[ Packagist](https://packagist.org/packages/askupa-software/amarkal-metabox)[ RSS](/packages/askupa-software-amarkal-metabox/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

amarkal-metabox [![Build Status](https://camo.githubusercontent.com/3f11edb948487707103ccd881aefc6311828a6805a77cc3a4bc6d9e302fe11ed/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616d61726b616c2f616d61726b616c2d6d657461626f782f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/amarkal/amarkal-metabox/build-status/master) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/3ad8ba660e8bf60bc5bbce5223e990c3c94329b927bfe0f64d6b4ae9d8b0c0f3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616d61726b616c2f616d61726b616c2d6d657461626f782f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/amarkal/amarkal-metabox/?branch=master) [![License](https://camo.githubusercontent.com/d188773d1e42345ca962ea6fc380b95718673e52fe59160bc38e5889034e3289/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d2d332e302532422d7265642e737667)](https://raw.githubusercontent.com/amarkal/amarkal-metabox/master/LICENSE)
===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#amarkal-metabox---)

Add metaboxes with [amarkal-ui](https://github.com/amarkal/amarkal-ui) components to any post type in WordPress.

**Tested up to:** WordPress 4.7
**Dependencies**: *[amarkal-ui](https://github.com/amarkal/amarkal-ui)*

[![amarkal-metabox](https://camo.githubusercontent.com/845125ea8b6b37ca197f930f7b11f00efdf0b8ed1a8611bb2101b2293f5e0b5c/68747470733a2f2f61736b757061736f6674776172652e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30342f616d61726b616c2d6d657461626f782e706e67)](https://camo.githubusercontent.com/845125ea8b6b37ca197f930f7b11f00efdf0b8ed1a8611bb2101b2293f5e0b5c/68747470733a2f2f61736b757061736f6674776172652e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031352f30342f616d61726b616c2d6d657461626f782e706e67)

Overview
--------

[](#overview)

**amarkal-metabox** lets you add metaboxes to any post type (posts, pages &amp; custom post types) using UI components from [amarkal-ui](https://github.com/amarkal/amarkal-ui/).

Installation
------------

[](#installation)

### Via Composer

[](#via-composer)

If you are using the command line:

```
$ composer require askupa-software/amarkal-metabox:dev-master

```

Or simply add the following to your `composer.json` file:

```
"require": {
    "askupa-software/amarkal-metabox": "dev-master"
}
```

And run the command

```
$ composer install

```

This will install the package in the directory `vendors/askupa-software/amarkal-metabox`. Now all you need to do is include the composer autoloader.

```
require_once 'path/to/vendor/autoload.php';
```

### Manually

[](#manually)

Download [amarkal-ui](https://github.com/amarkal/amarkal-ui/archive/master.zip) and [amarkal-metabox](https://github.com/amarkal/amarkal-metabox/archive/master.zip) from github and include them in your project.

```
require_once 'path/to/amarkal-ui/bootstrap.php';
require_once 'path/to/amarkal-metabox/bootstrap.php';
```

Reference
---------

[](#reference)

### amarkal\_add\_meta\_box

[](#amarkal_add_meta_box)

*Add a meta box to a given post type.*

```
amarkal_add_meta_box( $id, array $args )
```

This function can be used to add metaboxes to a given post type, and it uses arguments similar to WordPress' [`add_meta_box()`](https://developer.wordpress.org/reference/functions/add_meta_box/). However, as oppose to `add_meta_box()`, this function accepts a list of UI fields, which it will render and handle the saving process of. See [amarkal-ui](https://github.com/amarkal/amarkal-ui/) for supported field types, or register your own field type using `amarkal_ui_register_component`.

**Parameters**

- `$id` (*String*) Specifies metabox's ID.
- `$args` (*Array*) Specifies a list of metabox arguments:
    - `title` (*String*) Specifies the title of the meta box.
    - `screen` (*String|Array|WP\_Screen*) Specifies the screen or screens on which to show the box (such as a post type, 'link', or 'comment'). Accepts a single screen ID, WP\_Screen object, or array of screen IDs. Defaults to `null`.
    - `context` (*String*) Specifies the context within the screen where the boxes should display. Available contexts vary from screen to screen. Post edit screen contexts include 'normal', 'side', and 'advanced'. Comments screen contexts include 'normal' and 'side'. Menus meta boxes (accordion sections) all use the 'side' context. Defaults to 'advanced'.
    - `priority` (*String*) Specifies the priority within the context where the boxes should show ('high', 'low'). Defaults to `'default'`.
    - `fields` (*Array*) Array of arrays. Specifies a list of [amarkal-ui](https://github.com/amarkal/amarkal-ui) component array arguments. Each array should have the original UI component arguments as specified in [amarkal-ui](https://github.com/amarkal/amarkal-ui), as well as the following arguments:
        - `type` (*String*) Specifies the type of the UI component. One of the core `amarkal-ui` components or a registered custom component.
        - `title` (*String*) Specifies the field's title.
        - `description` (*String*) Specifies a short description that will be printed below the field's title.

**Example Usage**

```
// Add a metabox to the 'page' post type
amarkal_add_meta_box('my_meta_box', array(
    'title'     => 'My Meta Box',
    'screen'    => 'page',
    'context'   => 'normal',
    'priority'  => 'default',
    'fields'    => array(
    	array(
            'type'        => 'text',
            'title'       => 'Page Subtitle',
            'name'        => 'page_subtitle',
            'description' => 'The page\'s subtitle.',
            'default'     => 'Some default value',
            'filter'      => function($v) {
                return sanitize_text_field($v);
            },
            'validation'  => function($v,&$e) {
                return true;
            }
        )
    )
));

// Then you can retrieve the data using:
$subtitle = amarkal_get_meta_box_value( 'my_meta_box', 'page_subtitle', $post_id );
```

### amarkal\_get\_meta\_box\_value

[](#amarkal_get_meta_box_value)

*Get the value of a given field, optionally returning the default value if no value exists in the database.*

```
amarkal_get_meta_box_value( $metabox_id, $name, $post_id )
```

This function can be used to retrieve the value of a given meta field and a post id. If there is no value in the database for the given meta field and post id, the default field value will be returned.

**Parameters**

- `$metabox_id` (*String*) Specifies the metabox's ID.
- `$name` (*String*) Specifies the field's name.
- `$post_id` (*Number*) Specifies the post's ID.

**Example Usage**

```
$value = amarkal_get_meta_box_value( 'my_meta_box', 'field_name', $post_id );
```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/968f78380ddac9ca295244f1cd8d53e3abfe572a0a7351e9bc1b7fc2f85e6bfe?d=identicon)[askupasoftware](/maintainers/askupasoftware)

---

Top Contributors

[![ykadosh](https://avatars.githubusercontent.com/u/7763083?v=4)](https://github.com/ykadosh "ykadosh (19 commits)")

---

Tags

amarkalwordpresswordpress-framework

### Embed Badge

![Health badge](/badges/askupa-software-amarkal-metabox/health.svg)

```
[![Health](https://phpackages.com/badges/askupa-software-amarkal-metabox/health.svg)](https://phpackages.com/packages/askupa-software-amarkal-metabox)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
