Excerpt instead of content on archive pages

Hi all,

Silly me, I can't seem to find where I should edit to call the_except instead of the_content for archive pages in Blogs-MU (child-theme of course). I'm used to seeing archive.php files in themes but there isn't one in Blogs-MU.

Any help?

  • Patrick

    Hi rossterling,

    Sorry I didn't see this post earlier... wasn't tracking it.

    To show the excerpts instead of the whole posts on archives in your blogs-mu-child theme (I'm assuming you're using the child-theme), open blogs-mu-child/index.php and scroll to where you see:

    <div class="post-content">
    <?php do_action( 'bp_before_post_content' ) ?>
    
    <?php if(function_exists('the_post_thumbnail')) { ?><?php if(get_the_post_thumbnail() != "") { ?><div class="alignleft">
    <?php the_post_thumbnail(); ?></div><?php } } ?>
    <?php the_excerpt();?>
    <?php if (function_exists('wp_ozh_wsa')) { wp_ozh_wsa("336280nocolor"); } ?>
    
    <?php do_action( 'bp_after_post_content' ) ?>
    </div>

    Replace that entire snippet with this:

    <div class="post-content">
    <?php do_action( 'bp_before_post_content' ) ?>
    
    <?php if( is_date() || is_search() || is_tag() || is_author() || is_category() ) { ?>
    <?php if(function_exists('the_post_thumbnail')) { ?><?php if(get_the_post_thumbnail() != "") { ?><div class="alignleft">
    <?php the_post_thumbnail(); ?></div><?php } } ?>
    <?php the_excerpt();?>
    <?php if (function_exists('wp_ozh_wsa')) { wp_ozh_wsa("336280nocolor"); } ?>
    <?php } else { ?>
    
    <?php the_content( __('<p>Click here to read more</p>',TEMPLATE_DOMAIN) ); ?>
    <?php wp_link_pages('before=<p>&after=</p>'); ?>
    <?php if (function_exists('wp_ozh_wsa')) { wp_ozh_wsa("336280nocolor"); } ?>
    <?php } ?>
    
    <?php do_action( 'bp_after_post_content' ) ?>
    </div>

    See the is_category() added to the first line? That will tell your theme to display excerpts on category archives as well as date, search, tag and author archives/pages.

    Hope this helps! :slight_smile:

  • rossterling

    Hi pcwriter - Thanks for the reply. I too, am used to making a simple edit to an archives.php file and couldn't find one for blogs-mu.

    Yes, I am using the blogs-mu child theme with buddypress and multisite enabled. I do not have a blogs-mu-child/index.php. So, I need to create one, right? So, to create one I should copy the blogs-mu/index.php and make the changes you specified and then upload it to blogs-mu-child, right?

    I am not understanding your directions. The index.php file as I downloaded it from here does not look like what you are indicating so I must have to do something more or different. Right now this is what the blogs-mu/index.php file looks like:

    <?php
    /*
    customization on index.php so static frontpage and post page can be use properly
    */
    ?>

    <?php if ( '' == get_option( 'page_on_front' ) || '0' == get_option( 'page_on_front' ) ) : $post_set_page = get_option( 'page_for_posts' ); ?>

    <?php if( is_home() && !is_page( $post_set_page ) ) { ?>

    <?php locate_template( array('index-home.php'), true ); ?>

    <?php } else { ?>

    <?php locate_template( array('index-post.php'), true ); ?>

    <?php } ?>

    <?php else: //if static frontpage were set ?>

    <?php locate_template( array('index-post.php'), true ); ?>

    <?php endif; ?>

  • rossterling

    Hi again pcwriter - Yes, the index-post.php file was the one to change.

    On line 23 there is this originally:

    <?php if( is_date() || is_search() || is_tag() || is_author() ) { ?>

    I changed it to this:

    <?php if( is_date() || is_search() || is_tag() || is_author() || is_category() ) { ?>

    I made a new index-post.php file and uploaded it to my blogs-mu-child theme and it works perfectly.

    Thanks so much!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.