SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    A Cold Dark Place...
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wordpress 2.2 Excerpt?

    Hi,

    I've been having a problem getting anyone at the wordpress forum to answer this, so I thought I would ask it here.

    I have wordpress 2.2 and a nice theme I really like. The only problem is that the theme shows the entire post on category/archive/search pages. I would like the category/archive/search pages to just display an excerpt from the post automatically. What code would have to be changed to do this?

    Here is the code for the archive page:

    <?php get_header(); ?>

    <!-- content ................................. -->
    <div id="content" class="archive">

    <?php if (have_posts()) : ?>

    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2>Posts filed under '<?php echo single_cat_title(); ?>'</h2>

    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2>Archive for <?php the_time('F jS, Y'); ?></h2>

    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2>Archive for <?php the_time('F, Y'); ?></h2>

    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2>Archive for <?php the_time('Y'); ?></h2>

    <?php /* If this is a search */ } elseif (is_search()) { ?>
    <h2>Search Results</h2>

    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2>Author Archive</h2>

    <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
    <h2>Blog Archives</h2>

    <?php } ?>

    <?php while (have_posts()) : the_post(); ?>

    <?php $custom_fields = get_post_custom(); ?>

    <?php if (isset($custom_fields["BX_post_type"]) && $custom_fields["BX_post_type"][0] == "mini") { ?>

    <hr class="low" />

    <div class="minientry">

    <p>
    <?php echo BX_remove_p($post->post_content); ?>
    <?php comments_popup_link('(0)', '(1)', '(%)', 'commentlink', ''); ?>
    <a href="<?php the_permalink(); ?>" class="permalink" title="Permalink"><?php the_time('M j, \'y') ?><!--, <?php the_time('h:ia') ?>--></a>
    <!--<em class="author"><?php the_author() ?></em>-->
    <?php edit_post_link('Edit','<span class="editlink">','</span>'); ?>
    </p>

    </div>

    <hr class="low" />

    <?php } else { ?>

    <div class="entry">

    <h3><a href="<?php the_permalink() ?>" title="Permalink"><?php the_title(); ?></a></h3>

    <?php ($post->post_excerpt != "")? the_excerpt() : BX_shift_down_headlines($post->post_content); ?>

    <p class="info"><?php if ($post->post_excerpt != "") { ?><a href="<?php the_permalink() ?>" class="more">Continue Reading</a><?php } ?>
    <?php comments_popup_link('Add comment', '1 comment', '% comments', 'commentlink', ''); ?>
    <em class="date"><?php the_time('F jS, Y') ?><!-- at <?php the_time('h:ia') ?>--></em>
    <!--<em class="author"><?php the_author(); ?></em>-->
    <?php edit_post_link('Edit','<span class="editlink">','</span>'); ?>
    </p>

    </div>

    <?php } ?>

    <?php endwhile; ?>

    <p><!-- this is ugly -->
    <span class="next"><?php previous_posts_link('Next Posts') ?></span>
    <span class="previous"><?php next_posts_link('Previous Posts') ?></span>
    </p>

    <?php else : ?>

    <h2>Not Found</h2>
    <p>Sorry, but you are looking for something that isn't here.</p>

    <?php endif; ?>

    </div> <!-- /content -->

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    //end code.

    Can anyone help?

  2. #2
    SitePoint Addict
    Join Date
    Aug 2004
    Location
    A Cold Dark Place...
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay I got that problem fixed, but I still have a question for you guys!

    How can I get multi-page posts working on wordpress 2.2? The plugin I used to use doesn't seem to be working on 2.2! ARGH.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •