Forums

[resolved] a simple "if...else..." - conditional tags-question (2 posts)

  1. buntstift
    Member
    Posted 3 years ago #

    hello,

    somehow i made nearly all themes work like i wanted them to do, sometimes using the conditional tags.
    but somehow this time my brain seems to be not working, i am producing php-errors.

    it is a very simple "condition", though:
    it takes place in "archive.php".

    if category 10 is displayed, the posts should be displayed via excerpt.
    if any other category is displayed, the posts should be displayed with their whole content.

    i tried several things like

    <?php if ( is_category(10) ) {
    echo '<?php the_excerpt(); ?>';
    } else {
    echo '<?php the_content(); ?>';
    }
    ?>

    but that didn't work.

    can someone give me a the right piece of code ?

    thank you in advance!
    buntstift

  2. buntstift
    Member
    Posted 3 years ago #

    sorry, i already have the answer.

    <?php if ( is_category(10) ) { ?>
    <?php the_excerpt(); ?>
    <?php } else { ?>
    <?php the_content(); ?>
    <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic