1

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 } ?>
2
<?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; ?>
  • 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
2
    <?php else : ?>
        <?php if( is_category( 60 ) ) : ?>
            <?php _e( 'Photos' ) ?>
        <?php else : ?>
            <?php _e( 'Blog Archives'); ?>
        <?php endif; ?>
<?php endif; ?>

Try something like this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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