MacBook Pro Desktop Scene with Plants & Guitar by Nathan da Silva

Conditional Template Classes in WordPress

For singe post vs feed:

<header class="entry-header 
    if ( is_single() ) : 
      echo 'container'; 

For context, this code would be inside of

📁 theme > 📁 template parts > 📄 content.php

Where 📄 content.php is being called within multiple templates:

📄 index.php
📄 single.php

The 📄 content.php conditionally displays content based on what template it is being displayed inside of.