How do I get FeedWordPress to display only a short summary or excerpt of syndicated posts, instead of the full content

Contents

[ hide ]

    For more how-tos and advice, return to How Do I …?

    Q. How do I get FeedWordPress to display only a short summary or excerpt of syndicated posts, instead of the full content?

    A. The best way for you to do this is to edit your WordPress template files so as to change what appears in the content section of your Post Loop. (You can edit template files directly from the WordPress administrative interface using Appearance –> Theme Editor, or you can edit them in a text editor on your own computer and upload them to your theme directory.)

    The Templates section of the Documentation Wiki documents the template tags that FeedWordPress provides when it is activated; the most important tags for this particular task is is_syndicated(). What you need to do is identify the Post Loop for your Theme, which typically looks something like this:

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

    <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>

    <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div>

    <p class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', , ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div>

    <?php endwhile; ?>

    (This example is taken from Kubrick, the default theme for WordPress 2.x. Different themes may have different post loops, but you can almost always identify them by finding while (have_posts()) : the_post(). In most themes, you will need to find the post loop in the Main Index Template (index.php), the Archives template (archive.php), and possibly the Single Post (single.php) and Search Results (search.php) templates. Some Themes, in order to avoid duplication, use a different template file, often called post-content.php or something similar, or a function in the Theme Functions (functions.php) template, to handle all displaying of post contents.)

    Anyway. Once you have found your post loop, you need to replace the template function the_content() with a code that will take an excerpt and display that. For example, by changing this portion of the loop:

                <div class="entry">
                    <?php the_content('Read the rest of this entry &raquo;'); ?>
                </div>
    

    To read like this instead:

                <div class="entry">
                    <?php if (is_syndicated()) :
                         // Strip down to an excerpt
                         $text = get_the_content(); $text = strip_tags($text);
                         if (strlen($text) > 255) :
                              $text = substr($text, 0, 252).'...';
                         endif;
                         print $text;
                    else :
                         the_content('Read the rest of this entry &raquo;');
                    endif; ?>
                </div>
    

    Does that answer your question? If not, use the Talk page to comment on this post or contact me by e-mail for help. Be sure to describe what you are trying to do, and the problems you are running into, with as much detail as possible.

    For more how-tos and advice, return to How Do I …?

    This page is a Wiki! Log in or register an account to edit.

    14 thoughts on “How do I get FeedWordPress to display only a short summary or excerpt of syndicated posts, instead of the full content

    1. It worked to clip the content to, for me 800 characters. BUT – the images disappears! Is there any other way to go around:

                   $text = get_the_content(); $text = strip_tags($text);
                   if (strlen($text) > 255) :
                        $text = substr($text, 0, 252).'...';
      
    2. I tried implementing both codes (short & long) and neither did anything. I have to assume it’s not recognizing the “is_syndicated()” function. Is there anyway to fix this?

    3. It looks like my syndicated posts are being truncated with […]

      I’m sure it has something to do with the excerpt, but I’ll need to dig further. Have you seen this before?

      • I think I found it – If the blog I’m syndicationg has their settings to only display a summary in a feed that would only allow me to syndicate that blog’s ‘excerpt’.

        Correct?

        This could be construed as subversive, but is there a way around that?

        It’s more about not needing to manage the technical knowledge of the users whose blogs I have consent to syndicate.

    Leave a Reply

    Your email address will not be published. Required fields are marked *