Custom Markup Variable for button group

[ad_1]

Plugin Author
WPLake

(@wplakeorg)

Hi @dotnetdiva

Unfortunately the code you provided wouldn’t work, as it has syntax errors.

Please see below for a code snippet. You can use that as a base. See the “fixme” comment lines in the file, where you’d need to replace it with your values.

Kindly note that in the Database, only the value of the selected choice is stored (from the field settings). So, if your button group has the selected choice as ‘base: Base’, you’ll need to compare exactly with ‘base’, but not with ‘Base’.

<?php

// fixme use your field name in the quotes instead of 'base_game'
$baseName = $_fields['base_game'] ?? '';

$baseDescription = '';

switch ($baseName) {
    // fixme use your target value in the quotes
    case 'base':
        // fixme use your target label in the quotes
        $baseDescription = 'Expansion';
        break;
}

return [
    'baseDescription' => $baseDescription,
];

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer