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 Answers 2

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; ?>
2
  • 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. Commented Feb 10, 2012 at 22:04
  • Well spotted. Updated answer Commented Feb 11, 2012 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 and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.