“if category x”-conditions on posts @ index.php ?
-
hello,
i noticed that the conditional-tags i used inside “archive.php” won’t work at “index.php”. actually this is logical, because
“is_category(x)” will never be true at index.php, since it is the main page, not belonging to any category, right ?but is it possible to place conditional tags onto “index.php” changing the representation of posts belonging to one specified category ?
like having all posts displayed as an excerpt except one specific category being displayed via “the_content” at the front page?this is the code which works at archive.php, but of course doesn’t work at index.php:
<?php if ( is_category(4)) { ?> <?php the_content(); ?> <?php } else { ?> <?php the_excerpt(); ?> <?php } ?>
is it possible to get what i obviously tried with this piece of code at index.php ?
i already tried the “in_category”-tag, simply via replacing the “is” with “in” but this returned as a blank page.
i would be thankful for any comment. i am still a php noob.
- The topic ‘“if category x”-conditions on posts @ index.php ?’ is closed to new replies.