Load different headers based on post parent category
-
Hi, I need to do what the title explains.. so I’ve tried this code in single.php
<?php $category = get_the_category(); if ($category[0]->category_parent = 'approfondimenti') { get_header('regular-approfondimenti'); } elseif ($category[0]->category_parent = 'le-tue-campagne-salute') { get_header('regular-le-tue-campagne-salute'); } else { get_header(); } ?>
The first condition works but the second is totally ignored and the first header gets loaded instead. What am I doing wrong? Thanks for your help.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Load different headers based on post parent category’ is closed to new replies.