Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to edit the loop so if its on category ID 60 it displays "Photos" instead of "Blog".. how do I do this?

blog
    <?php if(is_archive()&&!is_category()&&!is_tag()&&!is_search()){ ?>

        <!-- BEGIN .archive-title -->
        <h1 class="page-title">

            <?php if ( is_day() ) : ?>
                    <?php printf( __( 'Daily Archives: %s'), get_the_date()); ?>
                <?php elseif ( is_month() ) : ?>
                    <?php printf( __( 'Monthly Archives: %s'), get_the_date( 'F Y' )); ?>
                <?php elseif ( is_year() ) : ?>
                    <?php printf( __( 'Yearly Archives: %s'), get_the_date( 'Y' )); ?>
                <?php else : ?>
                    <?php _e( 'Blog Archives'); ?>
            <?php endif; ?>

        <!-- END .archive-title -->
        </h1>

    <?php } ?>
share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted
<?php if( is_archive() && is_category() && !is_tag() && !is_search() ): ?>

    <!-- BEGIN .archive-title -->
    <h1 class="page-title">

        <?php if ( is_day() ): ?>
                <?php printf( __( 'Daily Archives: %s' ), get_the_date() ); ?>
            <?php elseif ( is_month() ): ?>
                <?php printf( __( 'Monthly Archives: %s' ), get_the_date( 'F Y' ) ); ?>
            <?php elseif ( is_year() ): ?>
                <?php printf( __( 'Yearly Archives: %s' ), get_the_date( 'Y' ) ); ?>
            <?php elseif ( is_category(60) ): ?>
                <?php _e( 'Photos' ); ?>
            <?php else : ?>
                <?php _e( 'Blog Archives' ); ?>
        <?php endif; ?>

    <!-- END .archive-title -->
    </h1>

<?php endif; ?>
share|improve this answer
    
the whole shown code starts with !is_category(). so you are checking for category60 in a part of the code that is never accessed for category archives. –  Michael Feb 10 '12 at 22:04
    
Well spotted. Updated answer –  Brady Feb 11 '12 at 11:57
add comment
    <?php else : ?>
        <?php if( is_category( 60 ) ) : ?>
            <?php _e( 'Photos' ) ?>
        <?php else : ?>
            <?php _e( 'Blog Archives'); ?>
        <?php endif; ?>
<?php endif; ?>

Try something like this.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.