Support » Fixing WordPress » Conditional is_category in attachment.php

  • 2bak860

    (@2bak860)


    Hi,

    I can’t get the following to work – does attachment.php accept conditional tags?

    <?php if (in_category(‘3’)) { ?>
    CAT 3!
    <?php } else {?>
    NOT CAT 3
    <?php } ?>

    thanks,

    R

Viewing 4 replies - 1 through 4 (of 4 total)
  • 2bak860

    (@2bak860)

    Actually, scrap that, instead:

    Does attachment.php recognise <?php post_class() ?> – as mine isn’t. What would be a suitable alternative?

    thanks in advance,

    R

    2bak860

    (@2bak860)

    Does attachment.php understand which category it is in?

    2bak860

    (@2bak860)

    Fixed my own problem.

    Shall I tell? Ok..

    My solution is to use get_category_parents. Good thread about it here:
    http://wordpress.org/support/topic/293262?replies=8

    what happens when you change the category though? on my install, the attachment never uses the correct template when it checks the attachment’s category

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditional is_category in attachment.php’ is closed to new replies.