Last active
February 9, 2019 23:41
-
-
Save Tmeister/47473f5c89c10a3413973f9487cd483f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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