Coming back to this, I’ve created a separate terms conditions for logos for the mobile version. While it is sound, the problem is that the logos for the desktop quit functioning correctly. There’s only ONE logo that displays across the board on desktop when there should be a different logo based on the taxonomy. So I’m not sure why there’s a conflict, especially since I’m using different variable terms for the desktop logos and the mobile logos. If I removed the code for the mobile logos, the desktop logos appear correctly. Vice versa if I was to remove the desktop, the mobile will load the correct logo.
I just need some happiness for both.
FOR MOBILE:
<header>
<div class="wsmobileheader clearfix">
<a id="wsnavtoggle" class="animated-arrow"><span></span></a>
<?php
$termsmob = get_the_terms( get_the_ID(), array ( 'practice-areas-types', 'category' ) );
if ( !empty($termsmob) && !is_wp_error($termsmob) ) :
$imagemob_echoed = false; // Flag to avoid multiple echoing
foreach ( $termsmob as $categorymob ) :
$termmob_name = $categorymob->name;
// Priority check for 'practice-areas-types' taxonomy first
if ( $categorymob->taxonomy == 'practice-areas-types' ) :
if ( $termmob_name == 'Data Breaches' ) :
echo '<a href="/"><span class="smallogo"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-data-breach-mob.svg" alt="Sacramento Data Breaches Lawyer Arnold Law Firm" width="160" style="margin-left:auto;margin-right:auto;"></span></a>';
$imagemob_echoed = true;
break;
elseif ( in_array( $termmob_name, ['Bicycle Accidents','Personal Injury','Car Accidents','Motorcycle Accidents','Truck Accidents','Airplane Accidents','Boating Accidents','Burn Injuries','Catastrophic Injuries', 'Defective Medical Products','Dog Bites','Drunk Driving Injuries','Food Poisoning','Hit and Run Accidents','Paralysis','Premises Liability','Spinal Cord Injuries','Traumatic Brain Injuries','Wrongful Death','Train Accidents','Shoulder Injuries','Broken Bones','Wildfires','Rideshare Accidents','Whiplash Injuries'] ) ) :
echo '<a href="/"><span class="smallogo"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/arnold-logo-white-2.svg" alt="Sacramento Personal Injury Lawyer Arnold Law Firm" width="160" style="margin-left:auto;margin-right:auto;"></span></a>';
$imagemob_echoed = true;
break;
elseif ( in_array( $termmob_name, ['Employment Law','Qui Tam/ Whistleblower','Wage and Hour'] ) ) :
echo '<a href="/"><span class="smallogo"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-employment-attorneys-mob.svg" alt="Sacramento Employment Lawyer Arnold Law Firm" width="160" style="margin-left:auto;margin-right:auto;"></span></a>';
$imagemob_echoed = true;
break;
elseif ( in_array( $termmob_name, ['Class Action','Product Safety','Dangerous Drugs','Data Breach'] ) ) :
echo '<a href="/"><span class="smallogo"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-class-action-mob.svg" alt="Sacramento Class Action Attorneys Arnold Law Firm" width="160" style="margin-left:auto;margin-right:auto;"></span></a>';
$imagemob_echoed = true;
break;
endif;
endif;
// If no image has been echoed yet, check for 'category' taxonomy
if ( !$imagemob_echoed && $categorymob->taxonomy == 'category' ) :
if ( $termmob_name == 'Data Breach' ) :
echo '<a href="/"><span class="smallogo"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-data-breach-mob.svg" alt="Sacramento Data Breaches Lawyer Arnold Law Firm" width="160" style="margin-left:auto;margin-right:auto;"></span></a>';
break;
elseif ( in_array( $termmob_name, ['Personal Injury', 'Auto Accidents', 'Motorcycle Accident', 'Trucking Accident', 'Airplane Accidents', 'Boating Accidents', 'Burn Injuries', 'Catastrophic Injuries', 'Defective Medical Products', 'Dog Bites', 'Drunk Driving Injuries', 'Food Poisoning', 'Hit and Run Accidents', 'Paralysis', 'Premises Liabilty', 'Spinal Cord Injuries', 'Traumatic Brain Injuries', 'Wrongful Death', 'Train Accidents', 'Shoulder Injuries', 'Broken Bones', 'Wildfires', 'Rideshare Accidents', 'Whiplash Injuries'] ) ) :
echo '<a href="/"><span class="smallogo"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/arnold-logo-white-2.svg" alt="Sacramento Personal Injury Lawyer Arnold Law Firm" width="160" style="margin-left:auto;margin-right:auto;"></span></a>';
break;
elseif ( in_array( $termmob_name, ['Employment Law','Qui Tam/ Whistleblower','Wage and Hour'] ) ) :
echo '<a href="/"><span class="smallogo"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-employment-attorneys-mob.svg" alt="Sacramento Employment Lawyer Arnold Law Firm" width="160" style="margin-left:auto;margin-right:auto;"></span></a>';
break;
elseif ( in_array( $termmob_name, ['Class Action Lawsuit', 'Product Safety', 'Dangerous Drugs', 'Data Breach'] ) ) :
echo '<a href="/"><span class="smallogo"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-class-action-mob.svg" alt="Sacramento Class Action Attorneys Arnold Law Firm" width="160" style="margin-left:auto;margin-right:auto;"></span></a>';
break;
endif;
endif;
endforeach;
else :
echo '<a href="/"><span class="smallogo"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/arnold-logo-white-2.svg" alt="Sacramento injury Lawyer Arnold Law Firm" width="160" style="margin-left:auto;margin-right:auto;"></span></a>';
endif;
?>
<a class="callusicon" href="tel:9167777777" onclick="ga('send', 'event', 'Phone', 'Click', 'Header');"><span class="fa fa-phone"></span><span class="screen-reader-text">Call Us</span></a>
</div>
FOR DESKTOP:
<div class="container-fluid shrink top-bar">
<div class="hidden-xs logo">
<?php
$terms = get_the_terms( get_the_ID(), array ( 'practice-areas-types', 'category' ) );
if ( !empty($terms) && !is_wp_error($terms) ) :
$image_echoed = false; // Flag to avoid multiple echoing
foreach ( $terms as $category ) :
$term_name = $category->name;
// Priority check for 'practice-areas-types' taxonomy first
if ( $category->taxonomy == 'practice-areas-types' ) :
if ( $term_name == 'Data Breaches' ) :
echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-data-breach-attorneys.avif" alt="Sacramento Data Breaches Lawyer Arnold Law Firm"></a>';
$image_echoed = true;
break;
elseif ( in_array( $term_name, ['Bicycle Accidents','Personal Injury','Car Accidents','Motorcycle Accidents','Truck Accidents','Airplane Accidents','Boating Accidents','Burn Injuries','Catastrophic Injuries', 'Defective Medical Products','Dog Bites','Drunk Driving Injuries','Food Poisoning','Hit and Run Accidents','Paralysis','Premises Liability','Spinal Cord Injuries','Traumatic Brain Injuries','Wrongful Death','Train Accidents','Shoulder Injuries','Broken Bones','Wildfires','Rideshare Accidents','Whiplash Injuries'] ) ) :
echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-accident-injury-attorneys.avif" alt="Sacramento Personal Injury Lawyer Arnold Law Firm"></a>';
$image_echoed = true;
break;
elseif ( in_array( $term_name, ['Employment Law','Qui Tam/ Whistleblower','Wage and Hour'] ) ) :
echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-employment-attorneys.avif" alt="Sacramento Employment Lawyer Arnold Law Firm"></a>';
$image_echoed = true;
break;
elseif ( in_array( $term_name, ['Class Action','Product Safety','Dangerous Drugs','Data Breach'] ) ) :
echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-class-action-attorneys.avif" alt="Sacramento Class Action Attorneys Arnold Law Firm"></a>';
$image_echoed = true;
break;
endif;
endif;
// If no image has been echoed yet, check for 'category' taxonomy
if ( !$image_echoed && $category->taxonomy == 'category' ) :
if ( $term_name == 'Data Breach' ) :
echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-data-breach-attorneys.avif" alt="Sacramento Data Breaches Lawyer Arnold Law Firm"></a>';
break;
elseif ( in_array( $term_name, ['Personal Injury', 'Auto Accidents', 'Motorcycle Accident', 'Trucking Accident', 'Airplane Accidents', 'Boating Accidents', 'Burn Injuries', 'Catastrophic Injuries', 'Defective Medical Products', 'Dog Bites', 'Drunk Driving Injuries', 'Food Poisoning', 'Hit and Run Accidents', 'Paralysis', 'Premises Liabilty', 'Spinal Cord Injuries', 'Traumatic Brain Injuries', 'Wrongful Death', 'Train Accidents', 'Shoulder Injuries', 'Broken Bones', 'Wildfires', 'Rideshare Accidents', 'Whiplash Injuries'] ) ) :
echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-accident-injury-attorneys.avif" alt="Sacramento Personal Injury Lawyer Arnold Law Firm"></a>';
break;
elseif ( in_array( $term_name, ['Employment Law','Qui Tam/ Whistleblower','Wage and Hour'] ) ) :
echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-employment-attorneys.avif" alt="Sacramento Employment Lawyer Arnold Law Firm"></a>';
break;
elseif ( in_array( $term_name, ['Class Action Lawsuit', 'Product Safety', 'Dangerous Drugs', 'Data Breach'] ) ) :
echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2025/arnold-class-action-attorneys.avif" alt="Sacramento Class Action Attorneys Arnold Law Firm"></a>';
break;
endif;
endif;
endforeach;
else :
echo '<a href="/"><img id="site-logo" class="img-responsive" src="' . esc_url(get_template_directory_uri()) . '/assets/images/2017/arnold-logo-new.svg" alt="Sacramento injury Lawyer Arnold Law Firm"></a>';
endif;
?>