Skip to content

Instantly share code, notes, and snippets.

@Tmeister
Last active February 9, 2019 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tmeister/47473f5c89c10a3413973f9487cd483f to your computer and use it in GitHub Desktop.
Save Tmeister/47473f5c89c10a3413973f9487cd483f to your computer and use it in GitHub Desktop.
<?php
/**
* Get the header BG color
*
* @return string
*/
public function blogColor()
{
$term = get_queried_object();
// What object type is?
$class_type = get_class($term);
// If is the taxonomy archive and the term is W
if (is_archive() && 'WP_Term' === $class_type) {
$has_custom_header = get_field('tax_custom_header', $term);
if ($has_custom_header) {
return get_field('tax_custom_header', $term);
}
return get_field('tax_header_color', 'options');
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment