WordPress.org

Support

Support » Themes and Templates » how to get the category of the parent?

how to get the category of the parent?

  • photocurio
    Member

    @photocurio

    I am using the following php on my site:
    <?php if (is_category('My Category')) { echo '<a href="http://linkhere.com">'; } ?>
    This is to add a link if something is in a particular category.

    I want to be able to use this on the image.php template, which doesn’t have a category.

    Is there a way to re-phrase it to look at the category of the post that the image is attached to? i’d assume this is the category of the parent.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to get the category of the parent?’ is closed to new replies.