• Hi,

    I have three different parent categories in my database, and want to change the single post page color based on the parent category of the category that the post is in. For a category page, to find out the parent, I’ve made..

    <?php $this_category = get_category($cat); ?>

    <div style=”
    <?php if ($this_category->category_parent == 33) { ?>
    background: #COLOR;
    “>

    But I can’t seem to extrapolate this to a single post. To repeat, I have a single permalink page (?p=X), but would like code that would let me test what the parent category of the single post’s category is. Any ideas?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to find the parent category on a single post page’ is closed to new replies.