get_headline_from_option()
public function get_headline_from_option( string $key, string $before, string $after, string $fallback = '' )
This method allows you to build headlines and other types of content from a theme option (or theme mod) more efficiently than by using the get_option() method. Option key values, if set and not empty, are passed through esc_html() and then the format_tags() class method. The primary purpose of this method is to provide a utility for writing more concise code.
#
Arguments- $key
(string) (required) The option key to check and use if is set and not empty. - $before
(string) (required) Markup to include before the processed value of the option key, if the option key is set and not empty, or a fallback value has been provided. - $after
(string) (required) Markup to include after the processed value of the option key, if the option key is set and not empty, or a fallback value has been provided. - $fallback
(string) (optional) An optional string to fall back to if the option key isn't set or is empty. If a fallback value is not provided and the option key isn't set or is empty, the method will return empty.