WordPress.org

Ready to get started?Download WordPress

Forums

How to find the parent category on a single post page (2 posts)

  1. retardedjimmy
    Member
    Posted 8 years ago #

    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?

  2. retardedjimmy
    Member
    Posted 8 years ago #

    Bump

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags