feat(wpmc S4): Helpers::main_town_slug reads ACF option
This commit is contained in:
@@ -99,4 +99,16 @@ final class Helpers
|
||||
$fragment = isset($parsed['fragment']) ? '#' . $parsed['fragment'] : '';
|
||||
return $path . $query . $fragment;
|
||||
}
|
||||
|
||||
public static function main_town_slug(): ?string
|
||||
{
|
||||
if (!\function_exists('get_field')) {
|
||||
return null;
|
||||
}
|
||||
$value = \get_field('main_town_slug', 'option');
|
||||
if ($value instanceof \WP_Term) {
|
||||
return $value->slug !== '' ? $value->slug : null;
|
||||
}
|
||||
return is_string($value) && $value !== '' ? $value : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user