Support Forum
Support › Meta Box Group › Groups within Tabs causing issues.
I have groups within tabs on the settings page. For some reason, something went wrong. The front end does not show what the backend shows. Any idea what could be causing this?
<?php
/**
* Check and setup theme's default settings
*
* @package UnderStrap
*/
// Exit if accessed directly.
defined('ABSPATH') || exit;
// Settings Page
add_filter('mb_settings_pages', function ($settings_pages) {
$settings_pages[] = [
'id' => 'effiliate',
'option_name' => 'effiliate',
'menu_title' => 'Theme Options',
'icon_url' => 'data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MDIuMiA2ODguOTEiPjxkZWZzPjxzdHlsZT4uY2xzLTF7ZmlsbDojZmZmO308L3N0eWxlPjwvZGVmcz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0yNDUuNSw2ODguNjVIMTJjLTEzLjQ5LDAtMTMuMzgsMC0xMC4yNS0xMy41NVEzMy42LDUzNy4xOSw2NS41MiwzOTkuMzFjMi4xNi05LjIzLDAtMTIuMjctOS41Mi0xMS4zMi04LjEuOC0xNi4zNS0uMTktMjQuNS4yNi04LC40NC0xMC44MS0uODQtOC41Ny0xMC4yNCwxNy4yOC03Mi41MiwzMy45MS0xNDUuMiw1MC43NS0yMTcuODIsMTEuNDktNDkuNTUsMjMuMjMtOTksMzQuMjYtMTQ4LjcsMi05LDUuNjktMTEuNSwxNC42OS0xMS40OFEzNTYuNzQuNDIsNTkwLjg0LDBjMTAuNTgsMCwxMywxLjcxLDEwLjM3LDEyLjgzLTEyLDQ5Ljg0LTIzLjA1LDk5Ljg4LTM0LDE1MC0yLDkuMTMtNS4zNywxMi40NS0xNS4zLDEyLjM5LTc5LjQtLjQ5LTE1OC44LS4wOS0yMzguMTktLjUxLTkuNzEsMC0xMy44NywyLjYzLTE1LjQsMTIuM2EzMTQuODIsMzE0LjgyLDAsMCwxLTguNDksMzYuMjdjLTIuMDcsNy4yOS0uNTEsOS41MSw3LjIyLDkuMzUsMjAuNjItLjQ0LDQxLjI1LS4xNSw2MS44OC0uMTVxNzguMjIsMCwxNTYuNDYsMGMxMy44OSwwLDEzLjg4LDAsMTAuODksMTMuMTEtMTAsNDMuOTEtMTkuODgsODcuODYtMzAuMTYsMTMxLjcxLTEuOTIsOC4xNy0xLjQ0LDEyLjEzLDguNTcsMTEuMDgsOC44NS0uOTMsMTcuODktLjQsMjYuODMtLjA4LDMuMjIuMTEsOS41LTIuMTIsNy45MSw0LjU3LTEuMTYsNC44NywxLjQzLDEyLjctNy4xNSwxMy44OC0zLjA1LjQyLTYuMjEuMTEtOS4zMy4xMS03Mi4zOSwwLTE0NC43OC4xNC0yMTcuMTctLjE4LTguNTEsMC0xMi4wNiwyLjEyLTEzLjgzLDEwLjk0LTUuNzIsMjguNTQtMTIuMDUsNTctMTkuMjYsODUuMi0yLjYxLDEwLjIuMTksMTEuNjYsOS40NiwxMS42Miw3OS40LS4yNywxNTguNzksMCwyMzguMTktLjM2LDkuMzYsMCwxMS42OSwxLjc2LDkuNDQsMTEuMzRxLTE3Ljc2LDc1LjM5LTM0LjMxLDE1MS4wN2MtMiw5LjE0LTUuNDEsMTIuNS0xNS4zNCwxMi40NUM0MDIsNjg4LjQ0LDMyMy43Myw2ODguNjUsMjQ1LjUsNjg4LjY1WiIvPjwvc3ZnPg==',
'tabs' => [
'general' => [
'label' => 'General Settings',
'icon' => 'dashicons-admin-settings',
],
'respg' => [
'label' => 'Resp Game',
'icon' => 'dashicons-admin-customizer',
],
'socials' => [
'label' => 'Socials',
'icon' => 'dashicons-admin-customizer',
],
],
];
return $settings_pages;
});
// Meta Boxes
add_filter('rwmb_meta_boxes', function ($meta_boxes) {
// General Settings Meta Box
$meta_boxes[] = [
'id' => 'general',
'title' => 'General',
'settings_pages' => 'effiliate',
'context' => 'normal',
'tab' => 'general',
'fields' => [
[
'name' => 'Logo Small',
'id' => 'logo-small',
'type' => 'file_input',
],
[
'name' => 'Hero XS BG',
'id' => 'hero-xs-bg',
'type' => 'file_input',
],
[
'name' => 'Default Flag',
'id' => 'default-flag',
'type' => 'file_input',
],
[
'name' => 'Hero LG BG',
'id' => 'hero-lg-bg',
'type' => 'file_input',
],
[
'name' => 'GTM Code',
'id' => 'gtm-code',
'type' => 'textarea',
],
[
'name' => 'Site Currency',
'id' => 'currency',
'type' => 'text',
],
[
'name' => 'Modal Offer',
'id' => 'offer',
'type' => 'post',
'post_type' => 'bonus',
'field_type' => 'select_advanced',
'placeholder' => 'Select an offer',
'query_args' => [
'post_status' => ['draft', 'publish'],
'posts_per_page' => -1,
],
],
],
];
// Resp Game Meta Box
$meta_boxes[] = [
'id' => 'respg',
'title' => 'Resp Game',
'settings_pages' => 'effiliate',
'context' => 'normal',
'tab' => 'respg',
'fields' => [
[
'type' => 'wysiwyg',
'id' => 'rg-text',
'name' => 'Footer RG Text',
'required' => true,
],
[
'type' => 'wysiwyg',
'id' => 'rg-text-tnc',
'name' => 'Card T&Cs Intro Text',
],
[
'name' => 'Show T&Cs',
'id' => 'show-tnc',
'type' => 'checkbox',
'std' => 1,
],
[
'type' => 'group',
'id' => 'rg-links',
'clone' => true,
'collapsible' => true,
'name' => 'Resp Game Links',
'fields' => [
[
'name' => 'RG Logo',
'id' => 'rg-image',
'type' => 'file_input',
'required' => true,
],
[
'type' => 'url',
'id' => 'rg-url',
'name' => 'URL',
],
[
'type' => 'text',
'id' => 'rg-alt',
'name' => 'Alt Tag',
'required' => true,
],
[
'type' => 'number',
'min' => 0,
'step' => 1,
'id' => 'rg-width',
'name' => 'Image Width',
'required' => true,
],
[
'type' => 'number',
'min' => 0,
'step' => 1,
'id' => 'rg-height',
'name' => 'Image Height',
'required' => true,
],
],
],
],
];
// Socials Meta Box
$meta_boxes[] = [
'id' => 'socials',
'title' => 'Socials',
'settings_pages' => 'effiliate',
'context' => 'normal',
'tab' => 'socials',
'fields' => [
[
'type' => 'group',
'id' => 'socials-links',
'clone' => true,
'collapsible' => true,
'name' => 'Social Links',
'fields' => [
[
'name' => 'Social Type',
'id' => 'social-type',
'type' => 'select',
'multiple' => false,
'placeholder' => 'Select a social media',
'select_all_none' => false,
'options' => [
'facebook' => 'Facebook',
'x' => 'X',
'instagram' => 'Instagram',
],
],
[
'type' => 'url',
'id' => 'social-url',
'name' => 'URL',
],
[
'type' => 'text',
'id' => 'social-title',
'name' => 'Social Title',
],
],
],
],
];
return $meta_boxes;
});
Hello,
What do you mean "the front end does not show what the backend shows"? Please share the code that you use to output the field value in the frontend and some screenshots of the value on both sides (front, back) on your site.
Hi,
Frontend Image: https://ibb.co/StC6wFr
Backend Image: https://ibb.co/7S3cVvs
<?php
defined('ABSPATH') || exit;
$socials = rwmb_meta('socials-links', ['object_type' => 'setting'], 'effiliate');
?>
<div class="social-links d-flex justify-content-center justify-content-md-end mt-2 mt-md-0">
<?php foreach ($socials as $social) { ?>
<?php if (!empty($social['social-type'])) { ?>
<?php if ($social['social-type'] == 'facebook') { ?>
<a href="<?php echo $social['social-url'] ?>" target="_blank" rel="nofollow" title="<?php echo $social['social-title'] ?>" class="facebook">
<img src="<?php echo THEME_IMG_PATH; ?>/icons/facebook.svg" width="16" height="16" alt="Facebook Logo" />
</a>
<?php } ?>
<?php if ($social['social-type'] == 'x') { ?>
<a href="<?php echo $social['social-url'] ?>" target="_blank" rel="nofollow" title="<?php echo $social['social-title'] ?>" class="x">
<img src="<?php echo THEME_IMG_PATH; ?>/icons/x.svg" width="16" height="16" alt="X Logo" />
</a>
<?php } ?>
<?php if ($social['social-type'] == 'instagram') { ?>
<a href="<?php echo $social['social-url'] ?>" target="_blank" rel="nofollow" title="<?php echo $social['social-title'] ?>" class="instagram">
<img src="<?php echo THEME_IMG_PATH; ?>/icons/instagram.svg" width="16" height="16" alt="Instagram Logo" />
</a>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
Hello,
It looks like the first cloneable group entry isn't displayed in the admin area. Please ensure that you have the latest version of Meta Box 5.10.2 and other extension plugins then check the issue again.
Hi, Meta Box is at 5.10.2, and Meta Box Tabs is at Version 1.1.17, however the issue still persists.
Hello,
Please share your site admin account by submitting this contact form https://metabox.io/contact/
I will take a look.