WordPress.org

Ready to get started?Download WordPress

Forums

Conditional is_category in attachment.php (5 posts)

  1. 2bak860
    Member
    Posted 4 years ago #

    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

  2. 2bak860
    Member
    Posted 4 years ago #

    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

  3. 2bak860
    Member
    Posted 4 years ago #

    Does attachment.php understand which category it is in?

  4. 2bak860
    Member
    Posted 4 years ago #

    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

  5. tgiokdi
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.