Trying to load a responsive CSS media query using Custom Taxonmy

Seems there are a few elements missing

First is the quotes in is_tax(country), should be is_tax(‘country’)

Second you are missing closing and opening PHP tags

When working with action that require html output you can do it in a few ways.
For now we will stick with the method you wanted to use.

The final result would look like this

add_action( 'wp_head', function () {
  if ( is_tax('country') ) {
?>
  <style>
  @media (max-width: 768px) {
    .site-content {
      display: flex;
      flex-direction: column-reverse;
    }
  }
  </style>
<?php
  }
} );

Leave a Comment