ramphor/wallery

WordPress gallery for meta box and frontend post

1.6.0 2021-03-21 14:14 UTC

This package is auto-updated.

Last update: 2022-04-21 16:57:15 UTC


README

WordPress gallery for meta box and frontend post

Installing

composer require ramphor/wallery

Setup

Use Wallery classes

<?php
use Ramphor\Wallery\Wallery;
use Ramphor\Wallery\Factory\MetaboxFactory;

Create metabox

<?php
if ( class_exists( Wallery::class ) ) {
    $walleryFactory  = new MetaboxFactory('Image Heading Text');
    $walleryInstance = new Wallery( $walleryFactory );

    $walleryInstance->setId( 'the_key_name_to_store_gallary_to_database' );
}

Render wallery metabox

<?php
add_action('add_meta_boxes', 'wallery_register_metabox');
function wallery_register_metabox() {
    add_meta_box(
        'metabox_id',
        'Metabox text title',
        array( $walleryInstance, 'render' ),
        'chapter'
    );
}