Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Eddie Moya

    (@eddiemoya)

    Im not sure what image.php is. Is it simply part if the theme your using? Or is it part of the template hierarchy that Im not familiar with?

    Attachments are a post type like any other. So generally speaking anything that shows a list of images is going to have some sort of loop. All you need to do is have the id for that image, and pass it to a function like wp_get_object_terms().

    In the case of single image templates, that too should have access to the images ID. The same applies.

    Thread Starter Lord_Mord

    (@lord_mord)

    It is part of the 2012-Theme, it is the template for viewing an attachment. I already solved this yesterday and came to the same sollution:

    <?php $terms = get_the_terms( $post->ID , ‘category’ );
    foreach( $terms as $term ) {
    $cat = $term->name;
    unset($term);
    }?>

    Thanks for your reply!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get category in image.php’ is closed to new replies.