<?php

add_action('cmb2_admin_init', 'setup_lp');


function setup_lp()
{
    $versao = 1;

    $arrModelos = ['modelo1'=>'Modelo 1'];


    $cmb_options = new_cmb2_box(array(
        'id' => 'alt_setup_lp',
        'title' => 'Configurações da LP',
        'object_types' => array('options-page'),
        'icon_url'=>'dashicons-settings',
        //'parent_slug' => 'alt_group_setup',
        'option_key' => 'alt_setup_lp', // The option key and admin menu page slug.
        'icon_url' => 'dashicons-palmtree', // Menu icon. Only applicable if 'parent_slug' is left empty.

    ));

    $html_title = '<h2>Configurações de layout</h2>';
    $cmb_options->add_field(array(
        'before_row' => $html_title,
        'name' => 'Selecione o layout da página',
        'desc' => '',
        'id' => 'layout_lp',
        'type' => 'select',
        'default' => 'modelo1',
        'options' => $arrModelos,
    ));

}


function toobar_top_icon_lp($wp_admin_bar){

    $args = array(
        'id' => 'alt_setup_lp',     // id ofaltimus/woocommerce/inc/functions.php the existing child node (New > Post)
        'title' => 'Configurações da LP', // alter the title of existing node
        'href' => '/wp-admin/admin.php?page=alt_setup_lp',
        //'parent' => 'alt_menu_altimus',          // set parent to false to make it a top level (parent) node
    );
    $wp_admin_bar->add_node($args);

}


add_action('admin_bar_menu', 'toobar_top_icon_lp', 99);


