get_headline()
public function get_headline( string $key, string $before, string $after, string $fallback = '' )
This method allows you to build headlines and other types of content from post meta more efficiently than by using the get_meta() method. Meta 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 meta key to check and use if is set and not empty. - $before
(string) (required) Markup to include before the processed value of the meta key, if the meta 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 meta key, if the meta 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 meta key isn't set or is empty. If a fallback value is not provided and the meta key isn't set or is empty, the method will return empty.