[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,
];
