L
L
ligisayan2015-11-12 15:17:46
metadata
ligisayan, 2015-11-12 15:17:46

How to register metabox in wordpress?

Greetings! I created a new taxonomy in the wordpress admin panel and I want to add a new field with metadata to it. I'm doing it by analogy with the lambda theme , but I can't figure out why the field is not initialized. Code of the child theme 's functions.php file

class OxygennaTheme
{
    public $metaboxes = array();
      public function register_metabox($metabox)
    {
        $this->metaboxes[] = $metabox;
    }
}
$oxy_theme = new OxygennaTheme();
$oxy_theme->register_metabox(array(
    'id' => 'portfolio_masonry_metabox',
    'title' => __('Portfolio Masonry Options', 'lambda-admin-td'),
    'priority' => 'default',
    'context' => 'advanced',
    'pages' => array('oxy_portfolio_image'),
    'fields' => array(
        array(
            'name'    => __('Masonry Image Width ', 'lambda-admin-td'),
            'desc'    => __('Select the width that the masonry portfolio shortcode will use for this item (normal 1 column wide 2 columns)', 'lambda-admin-td'),
            'id'      => 'masonry_width',
            'type'    => 'select',
            'options' => array(
                'normal'    => __('Normal', 'lambda-admin-td'),
                'wide'   => __('Wide', 'lambda-admin-td'),
            ),
            'default' => 'normal',
        ),
    )
));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Borisovich, 2015-11-12
@Alexufo

It looks like you have some kind of plugin that should read this code, see the documentation for it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question