'[product_dimensions] ', ); public $display_name = 'All dimensions'; protected function __construct() { $dimensionFormat = str_replace('%', '', UserSettings::getOption('lwhFormat', '%L x %W x %H')); $this->display_name .= " ($dimensionFormat)"; parent::__construct(); } public function getValue($post, $field) { try { $defaultFormat = '%L x %W x %H'; $str = UserSettings::getOption('lwhFormat', $defaultFormat); $l = get_post_meta($post->ID, "_length", true); $w = get_post_meta($post->ID, "_width", true); $h = get_post_meta($post->ID, "_height", true); if ($l === '' && $w === '' && $h === '') { return ''; } if ($str === $defaultFormat) { if ($l === '' && $w !== '' && $h !== '') { $str = '%W x %H'; } elseif ($l !== '' && $w !== '' && $h === '') { $str = '%L x %W'; } elseif ($l !== '' && $w === '' && $h !== '') { $str = '%L x %H'; } elseif ($l !== '' && $w === '' && $h === '') { $str = '%L'; } elseif ($l === '' && $w !== '' && $h === '') { $str = '%W'; } elseif ($l === '' && $w === '' && $h !== '') { $str = '%H'; } } $str = str_replace("%L", $l, $str); $str = str_replace("%W", $w, $str); $str = str_replace("%H", $h, $str); return $str; } catch (\Throwable $th) { return ""; } } }